kit

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

fpcmp_float_eq.c (317B)


      1 /* float == and != as bool results (fcmp s, s + cset). volatile operands
      2  * defeat constant folding. Exit: 20 + 22 = 42. */
      3 int test_main(void) {
      4   volatile float a = 1.5f, b = 1.5f, c = -4.0f;
      5   int eq = (a == b); /* 1 */
      6   int ne = (a != c); /* 1 */
      7   int r = 0;
      8   if (eq) r += 20;
      9   if (ne) r += 22;
     10   return r;
     11 }