kit

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

fpcmp_double_lt.c (430B)


      1 /* double <, <=, >, >= as bool results (fcmp d, d + cset with various conds).
      2  * volatile operands defeat folding. Exit: sum of four 1s scaled = 42. */
      3 int test_main(void) {
      4   volatile double a = 1.25, b = 2.5;
      5   int lt = (a < b);  /* 1 */
      6   int le = (a <= b); /* 1 */
      7   int gt = (b > a);  /* 1 */
      8   int ge = (b >= a); /* 1 */
      9   int r = 0;
     10   if (lt) r += 10;
     11   if (le) r += 10;
     12   if (gt) r += 11;
     13   if (ge) r += 11;
     14   return r;
     15 }