kit

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

fpcmp_zero.c (428B)


      1 /* Comparison against the literal 0.0 can lower to the fcmp-with-zero form
      2  * (fcmp d, #0.0 / fcmp s, #0.0) which is encoded differently from the
      3  * register-register fcmp. volatile defeats folding. Exit: 21 + 21 = 42. */
      4 int test_main(void) {
      5   volatile double d = 5.0;
      6   volatile float f = -3.0f;
      7   int r = 0;
      8   if (d > 0.0) r += 21;  /* taken: fcmp d, #0.0 */
      9   if (f < 0.0f) r += 21; /* taken: fcmp s, #0.0 */
     10   return r;
     11 }