kit

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

fpcmp_float_lt.c (419B)


      1 /* float <, <=, >, >= as bool results (fcmp s, s + cset with various conds).
      2  * volatile operands defeat folding. Exit: 10+10+11+11 = 42. */
      3 int test_main(void) {
      4   volatile float a = 0.5f, b = 7.5f;
      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 }