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, inconst LABEL)

eq(in NUM, in NUM, inconst LABEL)

eq(in STR, in STR, inconst LABEL)

eq(invar PMC, invar PMC, inconst LABEL)

eq(invar PMC, in INT, inconst LABEL)

eq(invar PMC, in NUM, inconst LABEL)

eq(invar PMC, in STR, inconst LABEL)

eq_str(invar PMC, invar PMC, inconst LABEL)

eq_num(invar PMC, invar PMC, inconst LABEL)

eq_addr(in STR, in STR, inconst LABEL)

eq_addr(invar PMC, invar PMC, inconst LABEL)

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, inconst LABEL)

ne(in NUM, in NUM, inconst LABEL)

ne(in STR, in STR, inconst LABEL)

ne(invar PMC, invar PMC, inconst LABEL)

ne(invar PMC, in INT, inconst LABEL)

ne(invar PMC, in NUM, inconst LABEL)

ne(invar PMC, in STR, inconst LABEL)

ne_str(invar PMC, invar PMC, inconst LABEL)

ne_num(invar PMC, invar PMC, inconst LABEL)

ne_addr(in STR, in STR, inconst LABEL)

ne_addr(invar PMC, invar PMC, inconst LABEL)

Branch if $1 is not equal to $2.

lt(in INT, in INT, inconst LABEL)

lt(in NUM, in NUM, inconst LABEL)

lt(in STR, in STR, inconst LABEL)

lt(invar PMC, invar PMC, inconst LABEL)

lt(invar PMC, in INT, inconst LABEL)

lt(invar PMC, in NUM, inconst LABEL)

lt(invar PMC, in STR, inconst LABEL)

lt_str(invar PMC, invar PMC, inconst LABEL)

lt_num(invar PMC, invar PMC, inconst LABEL)

Branch if $1 is less than $2.

le(in INT, in INT, inconst LABEL)

le(in NUM, in NUM, inconst LABEL)

le(in STR, in STR, inconst LABEL)

le(invar PMC, invar PMC, inconst LABEL)

le(invar PMC, in INT, inconst LABEL)

le(invar PMC, in NUM, inconst LABEL)

le(invar PMC, in STR, inconst LABEL)

le_str(invar PMC, invar PMC, inconst LABEL)

le_num(invar PMC, invar PMC, inconst LABEL)

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

gt(invar PMC, invar PMC, inconst LABEL)

gt(invar PMC, in INT, inconst LABEL)

gt(invar PMC, in NUM, inconst LABEL)

gt(invar PMC, in STR, inconst LABEL)

gt_str(invar PMC, invar PMC, inconst LABEL)

gt_num(invar PMC, invar PMC, inconst LABEL)

Branch if $1 is greater than $2.

ge(invar PMC, invar PMC, inconst LABEL)

ge(invar PMC, in INT, inconst LABEL)

ge(invar PMC, in NUM, inconst LABEL)

ge(invar PMC, in STR, inconst LABEL)

ge_str(invar PMC, invar PMC, inconst LABEL)

ge_num(invar PMC, invar PMC, inconst LABEL)

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

if_null(invar PMC, inconst LABEL)

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

if_null(invar STR, inconst LABEL)

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

unless_null(invar PMC, inconst LABEL)

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

unless_null(invar STR, inconst LABEL)

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-2008, The Perl Foundation.

LICENSE ^

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


parrot