[PATCH] D44909: [DAGCombine] (float)((int) f) --> ftrunc (PR36617)

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 08:52:07 PDT 2018


efriedma added a comment.

> After this change, is there some way to express this approach in C?

You can use platform-specific intrinsics, e.g. _mm_cvtsd_si32 is defined to return INT_MIN for out-of-range values.  Or, in portable C, you can do a range check: `if (x <= INT_MAX && x >= INT_MIN && (double)(int)x == x)`.


Repository:
  rL LLVM

https://reviews.llvm.org/D44909





More information about the llvm-commits mailing list