NAME ^

cmp.ops - Register Comparison Ops

DESCRIPTION ^

Operations that compare two registers against each other. Some of these operations affect control flow directly; others do not.

The variants with a prepended n_ like <n_not> generate a new target PMC. If possible, they use the appropriate language type, specified with .HLL.

Flow control comparison operators ^

These operators branch based on the relationship between their operands.

eq(in INT, in INT, labelconst INT)

eq(in NUM, in NUM, labelconst INT)

eq(in STR, in STR, labelconst INT)

eq(invar PMC, invar PMC, labelconst INT)

eq(invar PMC, in INT, labelconst INT)

eq(invar PMC, in NUM, labelconst INT)

eq(invar PMC, in STR, labelconst INT)

eq_str(invar PMC, invar PMC, labelconst INT)

eq_num(invar PMC, invar PMC, labelconst INT)

eq_addr(in STR, in STR, labelconst INT)

eq_addr(invar PMC, invar PMC, labelconst INT)

Branch if $1 is equal to $2. For PMCs this does a generic comparison, whatever that is for the involved PMCs. Mixed PMC number/string operands do a numeric or string comparison respectively.

eq_str and eq_num enforce string or number comparisons.

eq_addr compares the address of the objects or strings.

ne(in INT, in INT, labelconst INT)

ne(in NUM, in NUM, labelconst INT)

ne(in STR, in STR, labelconst INT)

ne(invar PMC, invar PMC, labelconst INT)

ne(invar PMC, in INT, labelconst INT)

ne(invar PMC, in NUM, labelconst INT)

ne(invar PMC, in STR, labelconst INT)

ne_str(invar PMC, invar PMC, labelconst INT)

ne_num(invar PMC, invar PMC, labelconst INT)

ne_addr(in STR, in STR, labelconst INT)

ne_addr(invar PMC, invar PMC, labelconst INT)

Branch if $1 is not equal to $2.

lt(in INT, in INT, labelconst INT)

lt(in NUM, in NUM, labelconst INT)

lt(in STR, in STR, labelconst INT)

lt(invar PMC, invar PMC, labelconst INT)

lt(invar PMC, in INT, labelconst INT)

lt(invar PMC, in NUM, labelconst INT)

lt(invar PMC, in STR, labelconst INT)

lt_str(invar PMC, invar PMC, labelconst INT)

lt_num(invar PMC, invar PMC, labelconst INT)

Branch if $1 is less than $2.

le(in INT, in INT, labelconst INT)

le(in NUM, in NUM, labelconst INT)

le(in STR, in STR, labelconst INT)

le(invar PMC, invar PMC, labelconst INT)

le(invar PMC, in INT, labelconst INT)

le(invar PMC, in NUM, labelconst INT)

le(invar PMC, in STR, labelconst INT)

le_str(invar PMC, invar PMC, labelconst INT)

le_num(invar PMC, invar PMC, labelconst INT)

Branch if $1 is less than or equal to $2.

gt(invar PMC, invar PMC, labelconst INT)

gt(invar PMC, in INT, labelconst INT)

gt(invar PMC, in NUM, labelconst INT)

gt(invar PMC, in STR, labelconst INT)

gt_str(invar PMC, invar PMC, labelconst INT)

gt_num(invar PMC, invar PMC, labelconst INT)

Branch if $1 is greater than $2.

ge(invar PMC, invar PMC, labelconst INT)

ge(invar PMC, in INT, labelconst INT)

ge(invar PMC, in NUM, labelconst INT)

ge(invar PMC, in STR, labelconst INT)

ge_str(invar PMC, invar PMC, labelconst INT)

ge_num(invar PMC, invar PMC, labelconst INT)

Branch if $1 is greater than or equal to $2.

if_null(invar PMC, labelconst INT)

Branch to $2 if $1 is a NULL PMC.

if_null(invar STR, labelconst INT)

Branch to $2 if $1 is a NULL STRING.

unless_null(invar PMC, labelconst INT)

Branch to $2 if $1 is not a NULL PMC.

unless_null(invar STR, labelconst INT)

Branch to $2 if $1 is not a NULL STRING.

Non-flow control comparison ops ^

These ops do comparisons and truth testing without doing flow control.

cmp(out INT, in INT, in INT)

cmp(out INT, in NUM, in NUM)

cmp(out INT, in STR, in STR)

cmp(out INT, invar PMC, invar PMC)

cmp(out INT, invar PMC, in INT)

cmp(out INT, invar PMC, in NUM)

cmp(out INT, invar PMC, in STR)

cmp_str(out INT, invar PMC, invar PMC)

cmp_num(out INT, invar PMC, invar PMC)

Sets $1 to -1 if $2 < $3, +1 if $2 > $3, and 0 otherwise.

issame(out INT, invar PMC, invar PMC)

issame(out INT, in STR, in STR)

Sets $1 to 1 or 0, depending on the identity of the 2 objects. The identity is the PMCs memory address.

isntsame(out INT, invar PMC, invar PMC)

isntsame(out INT, in STR, in STR)

Sets $1 to 0 or 1, depending on the identity of the 2 objects.

istrue(out INT, invar PMC)

Sets $1 to 1 or 0, depending on whether $2 is true or not.

isfalse(out INT, invar PMC)

Sets $1 to 1 or 0, depending on whether $2 is false or not.

isnull(out INT, in PMC)

Sets $1 to 1 if the object is null, 0 otherwise.

isgt(out INT, in INT, in INT)

isgt(out INT, in NUM, in NUM)

isgt(out INT, in STR, in STR)

These 3 opcodes are valid, but create as their reverse.

isgt(out INT, invar PMC, invar PMC)

Sets $1 to 1 if $2 is greater than $3.

isge(out INT, in INT, in INT)

isge(out INT, in NUM, in NUM)

isge(out INT, in STR, in STR)

These 3 opcodes are valid, but create as their reverse.

isge(out INT, invar PMC, invar PMC)

Sets $1 to 1 if $2 is greater than or equal to $3.

isle(out INT, in INT, in INT)

isle(out INT, in NUM, in NUM)

isle(out INT, in STR, in STR)

isle(out INT, invar PMC, invar PMC)

Sets $1 to 1 if $2 is less than or equal to $3.

islt(out INT, in INT, in INT)

islt(out INT, in NUM, in NUM)

islt(out INT, in STR, in STR)

islt(out INT, invar PMC, invar PMC)

Sets $1 to 1 if $2 is less than $3.

iseq(out INT, in INT, in INT)

iseq(out INT, in NUM, in NUM)

iseq(out INT, in STR, in STR)

iseq(out INT, invar PMC, invar PMC)

Sets $1 to 1 if $2 is equal to $3.

isne(out INT, in INT, in INT)

isne(out INT, in NUM, in NUM)

isne(out INT, in STR, in STR)

isne(out INT, invar PMC, invar PMC)

Sets $1 to 1 if $2 is not equal to $3.

Logical operations ^

These operations apply logical functions to their arguments.

and(out INT, in INT, in INT)

Short-circuiting logical and. Returns $2 if it's false, else returns $3.

not(inout INT)

not(invar PMC)

Set the boolean state of $1 to the opposite of the boolean state from $1.

not(out INT, in INT)

not(out PMC, invar PMC)

n_not(out PMC, invar PMC)

Set the boolean state of $1 to the opposite of the boolean state from $2.

or(out INT, in INT, in INT)

Short-circuiting logical or. Returns $2 if it's true, else returns $3.

xor(out INT, in INT, in INT)

Logical xor. Returns $2 if it's true and $3 isn't, returns $3 if it's true and $2 isn't, else returns false.

COPYRIGHT ^

Copyright (C) 2001-2004, The Perl Foundation.

LICENSE ^

This program is free software. It is subject to the same license as the Parrot interpreter itself.


parrot