Fix for PR2472. Use movss to set lower 32-bits of a zero XMM vector.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 10 Jul 2008 01:08:23 +0000 (01:08 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 10 Jul 2008 01:08:23 +0000 (01:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53386 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrSSE.td
test/CodeGen/X86/vec_set-J.ll [new file with mode: 0644]

index 74fcb5c7764319f3c081debf55e4771e907f01a8..16a52024b57471c8a988257dd72b466ea33d9e03 100644 (file)
@@ -2870,6 +2870,8 @@ def : Pat<(v4f32 (X86vzmovl (v4f32 (scalar_to_vector FR32:$src)))),
           (MOVLSS2PSrr (V_SET0), FR32:$src)>, Requires<[HasSSE2]>;
 def : Pat<(v4f32 (X86vzmovl (v4f32 VR128:$src))),
           (MOVLPSrr (V_SET0), VR128:$src)>, Requires<[HasSSE2]>;
+def : Pat<(v4i32 (X86vzmovl (v4i32 VR128:$src))),
+          (MOVLPSrr (V_SET0), VR128:$src)>, Requires<[HasSSE2]>;
 }
 
 // Splat v2f64 / v2i64
diff --git a/test/CodeGen/X86/vec_set-J.ll b/test/CodeGen/X86/vec_set-J.ll
new file mode 100644 (file)
index 0000000..488d360
--- /dev/null
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movss
+; PR2472
+
+define <4 x i32> @a(<4 x i32> %a) nounwind {
+entry:
+        %vecext = extractelement <4 x i32> %a, i32 0
+        insertelement <4 x i32> zeroinitializer, i32 %vecext, i32 0
+        %add = add <4 x i32> %a, %0
+        ret <4 x i32> %add
+}