icmp_cset_unsigned_long.c (692B)
1 /* Unsigned 64-bit ordering comparisons materialized to booleans: 2 * < -> cmp x,x + cset w, lo (cc) <= -> ls 3 * > -> hi >= -> hs (cs) 4 * The large operand has the top bit set so signed vs unsigned compares 5 * disagree; this pins the unsigned condition codes. volatile defeats folding. 6 * Exit code: a=7, b=0xfffffffffffffff0: lt=1 le=1 gt=0 ge=0 7 * 1*10 + 1*10 + 0*100 + 0*100 + 22 = 42. */ 8 int test_main(void) { 9 volatile unsigned long a = 7ul, b = 0xfffffffffffffff0ul; 10 int lt = (a < b); /* 1 (unsigned) */ 11 int le = (a <= b); /* 1 */ 12 int gt = (a > b); /* 0 */ 13 int ge = (a >= b); /* 0 */ 14 return lt * 10 + le * 10 + gt * 100 + ge * 100 + 22; 15 }