kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

icmp_cset_signed_int.c (546B)


      1 /* Signed 32-bit ordering comparisons materialized to booleans:
      2  *   <  -> cset w, lt   <= -> cset w, le
      3  *   >  -> cset w, gt   >= -> cset w, ge
      4  * volatile operands (one negative) defeat folding and force signed compares.
      5  * Exit code: with a=-3, b=7: lt=1 le=1 gt=0 ge=0
      6  *   1*10 + 1*10 + 0*100 + 0*100 + 22 = 42. */
      7 int test_main(void) {
      8   volatile int a = -3, b = 7;
      9   int lt = (a < b);  /* 1 */
     10   int le = (a <= b); /* 1 */
     11   int gt = (a > b);  /* 0 */
     12   int ge = (a >= b); /* 0 */
     13   return lt * 10 + le * 10 + gt * 100 + ge * 100 + 22;
     14 }