[PATCH] [DAGCombiner] Add support for FCEIL, FFLOOR and FTRUNC vector constant folding

Quentin Colombet qcolombet at apple.com
Fri Apr 3 14:27:09 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2848
@@ -2847,2 +2847,3 @@
   if (BuildVectorSDNode *BV = dyn_cast<BuildVectorSDNode>(Operand.getNode())) {
-    if (BV->isConstant()) {
+    if (BV->isConstant() && VT.isVector()) {
+      EVT SVT = VT.getVectorElementType();
----------------
RKSimon wrote:
> qcolombet wrote:
> > Naive question: Is it possible to have a BuildVector without a VT for a vector?
> Yes - x86_mmx registers choke on VT.getVectorElementType() if we don't have the VT.isVector() test to stop them.
Could you add a test case for that?

================
Comment at: test/CodeGen/X86/vec_floor.ll:228
@@ +227,2 @@
+  ret <4 x float> %t
+}
----------------
RKSimon wrote:
> RKSimon wrote:
> > qcolombet wrote:
> > > Could it be possible to add negative test when the conversion are not precise enough?
> > Yes I should be able to get something to work - probably with explicit hex values though.
> I haven't found anything that works yet - do you known of any equivalent values in other tests? I haven't found anything so far.
I guess you can check for FLT_MAX before doing a ceil and FLT_MIN for a floor.
Same for double.
But to be honest, I do not know better.

http://reviews.llvm.org/D8715

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list