[PATCH] D48085: [DAGCombiner] restrict (float)((int) f) --> ftrunc with no-signed-zeros

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 12 10:49:33 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:11049-11050
+  // replacing casts with a libcall. We also must be allowed to ignore -0.0
+  // because FTRUNC will return -0.0 for (-1.0, -0.0), but using integer
+  // conversions would return +0.0.
+  // FIXME: We should be able to use node-level FMF here.
----------------
Couldn't we do `and (ftrunc %x), (-1 >> 1)`, i.e. unset the sign bit?
Or is that worse than not transforming to `ftrunc` in the first place?


https://reviews.llvm.org/D48085





More information about the llvm-commits mailing list