kit

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

fpcmp_branch.c (413B)


      1 /* fp comparison used directly as a branch condition (fcmp + b.cond) rather
      2  * than materialized to a bool with cset. volatile operands defeat folding so
      3  * the compare and conditional branch survive. Exit: 42. */
      4 int test_main(void) {
      5   volatile double x = 6.0, y = 7.0;
      6   int r = 0;
      7   if (x < y)
      8     r += 42;
      9   else
     10     r += 1;            /* taken: x < y */
     11   if (x > y) r += 100; /* not taken */
     12   return r;
     13 }