[llvm-commits] [llvm] r119819 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp test/CodeGen/X86/bc-extract.ll
Mon P Wang
wangmp at apple.com
Fri Nov 19 11:08:13 PST 2010
Author: wangmp
Date: Fri Nov 19 13:08:12 2010
New Revision: 119819
URL: http://llvm.org/viewvc/llvm-project?rev=119819&view=rev
Log:
Make isScalarToVector to return false if the node is a scalar. This will prevent
DAGCombine from making an illegal transformation of bitcast of a scalar to a
vector into a scalar_to_vector.
Added:
llvm/trunk/test/CodeGen/X86/bc-extract.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=119819&r1=119818&r2=119819&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Nov 19 13:08:12 2010
@@ -199,6 +199,8 @@
if (N->getOperand(0).getOpcode() == ISD::UNDEF)
return false;
unsigned NumElems = N->getNumOperands();
+ if (NumElems == 1)
+ return false;
for (unsigned i = 1; i < NumElems; ++i) {
SDValue V = N->getOperand(i);
if (V.getOpcode() != ISD::UNDEF)
Added: llvm/trunk/test/CodeGen/X86/bc-extract.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/bc-extract.ll?rev=119819&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/bc-extract.ll (added)
+++ llvm/trunk/test/CodeGen/X86/bc-extract.ll Fri Nov 19 13:08:12 2010
@@ -0,0 +1,27 @@
+; RUN: llc < %s -march=x86-64 -mattr=+sse42 -disable-mmx | FileCheck %s
+
+
+define float @extractFloat1() nounwind {
+entry:
+ ; CHECK: 1065353216
+ %tmp0 = bitcast <1 x double> <double 0x000000003F800000> to <2 x float>
+ %tmp1 = extractelement <2 x float> %tmp0, i32 0
+ ret float %tmp1
+}
+
+define float @extractFloat2() nounwind {
+entry:
+ ; CHECK: pxor %xmm0, %xmm0
+ %tmp4 = bitcast <1 x double> <double 0x000000003F800000> to <2 x float>
+ %tmp5 = extractelement <2 x float> %tmp4, i32 1
+ ret float %tmp5
+}
+
+define i32 @extractInt2() nounwind {
+entry:
+ ; CHECK: xorl %eax, %eax
+ %tmp4 = bitcast <1 x i64> <i64 256> to <2 x i32>
+ %tmp5 = extractelement <2 x i32> %tmp4, i32 1
+ ret i32 %tmp5
+}
+
More information about the llvm-commits
mailing list