From 331e2bd942f395f3476f2b0c773e551c489a7bf1 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Thu, 10 Jul 2008 01:08:23 +0000 Subject: [PATCH] Fix for PR2472. Use movss to set lower 32-bits of a zero XMM vector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53386 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrSSE.td | 2 ++ test/CodeGen/X86/vec_set-J.ll | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 test/CodeGen/X86/vec_set-J.ll diff --git a/lib/Target/X86/X86InstrSSE.td b/lib/Target/X86/X86InstrSSE.td index 74fcb5c7764..16a52024b57 100644 --- a/lib/Target/X86/X86InstrSSE.td +++ b/lib/Target/X86/X86InstrSSE.td @@ -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 index 00000000000..488d3607341 --- /dev/null +++ b/test/CodeGen/X86/vec_set-J.ll @@ -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 +} -- 2.34.1