Soft float support for undef. Reported by Xerxes RĂ„nby.
authorDuncan Sands <baldrick@free.fr>
Wed, 8 Apr 2009 13:33:37 +0000 (13:33 +0000)
committerDuncan Sands <baldrick@free.fr>
Wed, 8 Apr 2009 13:33:37 +0000 (13:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68607 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
lib/CodeGen/SelectionDAG/LegalizeTypes.h
test/CodeGen/ARM/2009-04-08-FloatUndef.ll [new file with mode: 0644]

index 8aa3e940025a9dcf43cf34a4dca3093ac2e2fb65..5aa71ec0108f38f6439eefd567500dd779c5902c 100644 (file)
@@ -90,6 +90,7 @@ void DAGTypeLegalizer::SoftenFloatResult(SDNode *N, unsigned ResNo) {
     case ISD::SELECT_CC:   R = SoftenFloatRes_SELECT_CC(N); break;
     case ISD::SINT_TO_FP:
     case ISD::UINT_TO_FP:  R = SoftenFloatRes_XINT_TO_FP(N); break;
+    case ISD::UNDEF:       R = SoftenFloatRes_UNDEF(N); break;
     case ISD::VAARG:       R = SoftenFloatRes_VAARG(N); break;
   }
 
@@ -464,6 +465,10 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_SELECT_CC(SDNode *N) {
                      N->getOperand(1), LHS, RHS, N->getOperand(4));
 }
 
+SDValue DAGTypeLegalizer::SoftenFloatRes_UNDEF(SDNode *N) {
+  return DAG.getUNDEF(TLI.getTypeToTransformTo(N->getValueType(0)));
+}
+
 SDValue DAGTypeLegalizer::SoftenFloatRes_VAARG(SDNode *N) {
   SDValue Chain = N->getOperand(0); // Get the chain.
   SDValue Ptr = N->getOperand(1); // Get the pointer.
index 803e20f4bd9576dc20525f4a8060b9e35451be35..add978b02b6dc3035e452013ce7d7dc9e87cc557 100644 (file)
@@ -422,6 +422,7 @@ private:
   SDValue SoftenFloatRes_LOAD(SDNode *N);
   SDValue SoftenFloatRes_SELECT(SDNode *N);
   SDValue SoftenFloatRes_SELECT_CC(SDNode *N);
+  SDValue SoftenFloatRes_UNDEF(SDNode *N);
   SDValue SoftenFloatRes_VAARG(SDNode *N);
   SDValue SoftenFloatRes_XINT_TO_FP(SDNode *N);
 
diff --git a/test/CodeGen/ARM/2009-04-08-FloatUndef.ll b/test/CodeGen/ARM/2009-04-08-FloatUndef.ll
new file mode 100644 (file)
index 0000000..9dc3b34
--- /dev/null
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llc -march=arm
+
+define void @execute_shader(<4 x float>* %OUT, <4 x float>* %IN, <4 x float>* %CONST) {
+entry:
+       %input2 = load <4 x float>* null, align 16              ; <<4 x float>> [#uses=2]
+       %shuffle7 = shufflevector <4 x float> %input2, <4 x float> <float 0.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00>, <4 x i32> <i32 2, i32 2, i32 2, i32 2>             ; <<4 x float>> [#uses=1]
+       %mul1 = mul <4 x float> %shuffle7, zeroinitializer              ; <<4 x float>> [#uses=1]
+       %add2 = add <4 x float> %mul1, %input2          ; <<4 x float>> [#uses=1]
+       store <4 x float> %add2, <4 x float>* null, align 16
+       ret void
+}