cmp.ops - Register Comparison Ops
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
.
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(in PMC,
in PMC,
labelconst INT)
- eq(in PMC,
in INT,
labelconst INT)
- eq(in PMC,
in NUM,
labelconst INT)
- eq(in PMC,
in STR,
labelconst INT)
- eq_str(in PMC,
in PMC,
labelconst INT)
- eq_num(in PMC,
in PMC,
labelconst INT)
- eq_addr(in STR,
in STR,
labelconst INT)
- eq_addr(in PMC,
in 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.
- isnull(in PMC,
labelconst INT)
- Branch to $2 if $1 is a NULL PMC.
- ne(in INT,
in INT,
labelconst INT)
- ne(in NUM,
in NUM,
labelconst INT)
- ne(in STR,
in STR,
labelconst INT)
- ne(in PMC,
in PMC,
labelconst INT)
- ne(in PMC,
in INT,
labelconst INT)
- ne(in PMC,
in NUM,
labelconst INT)
- ne(in PMC,
in STR,
labelconst INT)
- ne_str(in PMC,
in PMC,
labelconst INT)
- ne_num(in PMC,
in PMC,
labelconst INT)
- ne_addr(in STR,
in STR,
labelconst INT)
- ne_addr(in PMC,
in 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(in PMC,
in PMC,
labelconst INT)
- lt(in PMC,
in INT,
labelconst INT)
- lt(in PMC,
in NUM,
labelconst INT)
- lt(in PMC,
in STR,
labelconst INT)
- lt_str(in PMC,
in PMC,
labelconst INT)
- lt_num(in PMC,
in 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(in PMC,
in PMC,
labelconst INT)
- le(in PMC,
in INT,
labelconst INT)
- le(in PMC,
in NUM,
labelconst INT)
- le(in PMC,
in STR,
labelconst INT)
- le_str(in PMC,
in PMC,
labelconst INT)
- le_num(in PMC,
in PMC,
labelconst INT)
- Branch if $1 is less than or equal to $2.
- gt(in PMC,
in PMC,
labelconst INT)
- gt(in PMC,
in INT,
labelconst INT)
- gt(in PMC,
in NUM,
labelconst INT)
- gt(in PMC,
in STR,
labelconst INT)
- gt_str(in PMC,
in PMC,
labelconst INT)
- gt_num(in PMC,
in PMC,
labelconst INT)
- Branch if $1 is greater than $2.
- ge(in PMC,
in PMC,
labelconst INT)
- ge(in PMC,
in INT,
labelconst INT)
- ge(in PMC,
in NUM,
labelconst INT)
- ge(in PMC,
in STR,
labelconst INT)
- ge_str(in PMC,
in PMC,
labelconst INT)
- ge_num(in PMC,
in PMC,
labelconst INT)
- Branch if $1 is greater than or equal to $2.
These operators branch based on the relationship between their operands.
- cmp(out INT,
in INT,
in INT)
- cmp(out INT,
in NUM,
in NUM)
- cmp(out INT,
in STR,
in STR)
- cmp(out INT,
in PMC,
in PMC)
- cmp(out INT,
in PMC,
in INT)
- cmp(out INT,
in PMC,
in NUM)
- cmp(out INT,
in PMC,
in STR)
- cmp_str(out INT,
in PMC,
in PMC)
- cmp_num(out INT,
in PMC,
in PMC)
- Sets $1 to -1 if $2 < $3,
+1 if $2 > $3,
and 0 otherwise.
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(in PMC)
- Set the boolean state of $1 to the opposite of the boolean state from $1.
- not(out INT,
in INT)
- not(out PMC,
in PMC)
- n_not(out PMC,
in 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.
These ops do comparisons and truth testing without doing flow control.
- issame(out INT,
in PMC,
in 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,
in PMC,
in 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,
in PMC)
- Sets $1 to 1 or 0,
depending on whether $2 is true or not.
- isfalse(out INT,
in PMC)
- Sets $1 to 1 or 0,
depending on whether $2 is false or not.
- isgt(out INT,
in PMC,
in PMC)
- Sets $1 to 1 if $2 is greater than $3.
- isge(out INT,
in PMC,
in 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,
in PMC,
in 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,
in PMC,
in 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,
in PMC,
in 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,
in PMC,
in PMC)
- Sets $1 to 1 if $2 is not equal to $3.
Copyright (C) 2001-2004 The Perl Foundation.
All rights reserved.
This program is free software.
It is subject to the same license as the Parrot interpreter itself.