SPA 5.0:
{@{!}Pg}
FSETP.cmp{.FTZ}
Pu, {-}{|}Ra{|}, {-}{|}Sb{|}
{&req_6}
{?sched}
;
.cmp: { .F, .LT, .EQ, .LE, .GT, .NE, .GE, .NUM, FP32 numeric comparisons .NAN, .LTU, .EQU, .LEU, .GTU, .NEU, .GEU, .T } FP32 numeric or Unordered comparisons .FTZ: Denorm inputs are flushed to sign preserving 0.0. .bop: { .AND, .OR, .XOR } Boolean op with predicate {!}Pp FSETP allows the following source Sb: Sb(register) Sb(constant with immediate address) Sb(#IMM20<<12)
{@{!}Pg}
FSETP.cmp{.FTZ}.bop
Pu, Pv, {-}{|}Ra{|}, {-}{|}Sb{|}, {!}Pp
{&req_6}
{?sched}
;
FSETP.cmp.bop compares register Ra and source operand Sb with FP32 comparison operation .cmp, combines the Boolean comparison result with predicate operand {!}Pp using the Boolean operation .bop, and sets two predicate registers Pu and Pv to Boolean values based on the comparison. The Boolean operation .bop may be .AND, .OR, or .XOR, corresponding to the C Boolean operations &, |, and ^.
Pu = (Ra .cmp Sb) .bop {!}Pp; Pv =(!(Ra .cmp Sb)) .bop {!}Pp;
Use .bop {!}Pp for nested predication, with an inner comparison of Ra vs. Sb, conditioned on outer predicate Pp.
The simple instruction format without .bop {!}Pp assembles as .AND PT, and Pv is PT, providing the following effective operation:
Pu = (Ra .cmp Sb); // Set predicate to 1 if comparison test is true, else 0
FSETP.LT P1, R1, -R2; // P1 = (R1 < -R2); FSETP.GEU.FTZ P1, R1, 2.5; // P1 = (FTZ(R1) >= 2.5) || isNan(R1); FSETP.EQ P1, R1, -|c[1][0x44]|; // P1 = (R1 == -|c[1][0x44]|); FSETP.LT.AND P1, P4, R1, R2, !P3; // P1 = (R1 < R2) & !P3; P4 = !(R1 < R2) & !P3;