blob: ee7567cf7609a690a6be92a79dd68e7a711c5d90 [file] [log] [blame]
Evan Chengf9393b32009-01-02 05:29:08 +00001; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2,-sse41 -o %t -f
Dan Gohman8c89a502007-08-15 13:36:28 +00002; RUN: grep movss %t | count 3
3; RUN: grep movhlps %t | count 1
4; RUN: grep pshufd %t | count 1
5; RUN: grep unpckhpd %t | count 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
Evan Cheng13559d62008-09-26 23:41:32 +00007define void @test1(<4 x float>* %F, float* %f) nounwind {
Tanya Lattner632e88a2008-02-21 07:42:26 +00008 %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2]
Dan Gohman7ce405e2009-06-04 22:49:04 +00009 %tmp7 = fadd <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1]
Tanya Lattner632e88a2008-02-21 07:42:26 +000010 %tmp2 = extractelement <4 x float> %tmp7, i32 0 ; <float> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000011 store float %tmp2, float* %f
12 ret void
13}
14
Evan Cheng13559d62008-09-26 23:41:32 +000015define float @test2(<4 x float>* %F, float* %f) nounwind {
Tanya Lattner632e88a2008-02-21 07:42:26 +000016 %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2]
Dan Gohman7ce405e2009-06-04 22:49:04 +000017 %tmp7 = fadd <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1]
Tanya Lattner632e88a2008-02-21 07:42:26 +000018 %tmp2 = extractelement <4 x float> %tmp7, i32 2 ; <float> [#uses=1]
19 ret float %tmp2
Dan Gohmanf17a25c2007-07-18 16:29:46 +000020}
21
Evan Cheng13559d62008-09-26 23:41:32 +000022define void @test3(float* %R, <4 x float>* %P1) nounwind {
Tanya Lattner632e88a2008-02-21 07:42:26 +000023 %X = load <4 x float>* %P1 ; <<4 x float>> [#uses=1]
24 %tmp = extractelement <4 x float> %X, i32 3 ; <float> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000025 store float %tmp, float* %R
26 ret void
27}
28
Evan Cheng13559d62008-09-26 23:41:32 +000029define double @test4(double %A) nounwind {
Tanya Lattner632e88a2008-02-21 07:42:26 +000030 %tmp1 = call <2 x double> @foo( ) ; <<2 x double>> [#uses=1]
31 %tmp2 = extractelement <2 x double> %tmp1, i32 1 ; <double> [#uses=1]
Dan Gohman7ce405e2009-06-04 22:49:04 +000032 %tmp3 = fadd double %tmp2, %A ; <double> [#uses=1]
Tanya Lattner632e88a2008-02-21 07:42:26 +000033 ret double %tmp3
Dan Gohmanf17a25c2007-07-18 16:29:46 +000034}
35
Tanya Lattner632e88a2008-02-21 07:42:26 +000036declare <2 x double> @foo()