[PATCH] D140294: clang: Replace implementation of __builtin_isnormal

Jay Foad via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 19 05:31:30 PST 2022


foad added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:3308
   case Builtin::BI__builtin_isnormal: {
-    // isnormal(x) --> x == x && fabsf(x) < infinity && fabsf(x) >= float_min
+    // isnormal(x) --> fabs(x) < infinity && !(fabs(x) < float_min)
     CodeGenFunction::CGFPOptionsRAII FPOptsRAII(*this, E);
----------------
Why not make both compares ordered and write this as just `fabs(x) < infinity && fabs(x) >= float_min`? That seems conceptually simpler - i.e. it makes the comment easier to understand and the IR no worse.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140294/new/

https://reviews.llvm.org/D140294



More information about the cfe-commits mailing list