Add a triple to switch.ll test.
[oota-llvm.git] / test / CodeGen / X86 / sse_partial_update.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-macosx -mattr=+sse2 -mcpu=nehalem | FileCheck %s
2
3 ; rdar: 12558838
4 ; PR14221
5 ; There is a mismatch between the intrinsic and the actual instruction.
6 ; The actual instruction has a partial update of dest, while the intrinsic
7 ; passes through the upper FP values. Here, we make sure the source and
8 ; destination of each scalar unary op are the same.
9
10 define void @rsqrtss(<4 x float> %a) nounwind uwtable ssp {
11 entry:
12 ; CHECK-LABEL: rsqrtss:
13 ; CHECK: rsqrtss %xmm0, %xmm0
14 ; CHECK-NEXT: cvtss2sd %xmm0
15 ; CHECK-NEXT: movshdup
16 ; CHECK-NEXT: cvtss2sd %xmm0
17 ; CHECK-NEXT: movap
18 ; CHECK-NEXT: jmp
19
20   %0 = tail call <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float> %a) nounwind
21   %a.addr.0.extract = extractelement <4 x float> %0, i32 0
22   %conv = fpext float %a.addr.0.extract to double
23   %a.addr.4.extract = extractelement <4 x float> %0, i32 1
24   %conv3 = fpext float %a.addr.4.extract to double
25   tail call void @callee(double %conv, double %conv3) nounwind
26   ret void
27 }
28 declare void @callee(double, double)
29 declare <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float>) nounwind readnone
30
31 define void @rcpss(<4 x float> %a) nounwind uwtable ssp {
32 entry:
33 ; CHECK-LABEL: rcpss:
34 ; CHECK: rcpss %xmm0, %xmm0
35 ; CHECK-NEXT: cvtss2sd %xmm0
36 ; CHECK-NEXT: movshdup
37 ; CHECK-NEXT: cvtss2sd %xmm0
38 ; CHECK-NEXT: movap
39 ; CHECK-NEXT: jmp
40
41   %0 = tail call <4 x float> @llvm.x86.sse.rcp.ss(<4 x float> %a) nounwind
42   %a.addr.0.extract = extractelement <4 x float> %0, i32 0
43   %conv = fpext float %a.addr.0.extract to double
44   %a.addr.4.extract = extractelement <4 x float> %0, i32 1
45   %conv3 = fpext float %a.addr.4.extract to double
46   tail call void @callee(double %conv, double %conv3) nounwind
47   ret void
48 }
49 declare <4 x float> @llvm.x86.sse.rcp.ss(<4 x float>) nounwind readnone
50
51 define void @sqrtss(<4 x float> %a) nounwind uwtable ssp {
52 entry:
53 ; CHECK-LABEL: sqrtss:
54 ; CHECK: sqrtss %xmm0, %xmm0
55 ; CHECK-NEXT: cvtss2sd %xmm0
56 ; CHECK-NEXT: movshdup
57 ; CHECK-NEXT: cvtss2sd %xmm0
58 ; CHECK-NEXT: movap
59 ; CHECK-NEXT: jmp
60
61   %0 = tail call <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float> %a) nounwind
62   %a.addr.0.extract = extractelement <4 x float> %0, i32 0
63   %conv = fpext float %a.addr.0.extract to double
64   %a.addr.4.extract = extractelement <4 x float> %0, i32 1
65   %conv3 = fpext float %a.addr.4.extract to double
66   tail call void @callee(double %conv, double %conv3) nounwind
67   ret void
68 }
69 declare <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float>) nounwind readnone
70
71 define void @sqrtsd(<2 x double> %a) nounwind uwtable ssp {
72 entry:
73 ; CHECK-LABEL: sqrtsd:
74 ; CHECK: sqrtsd %xmm0, %xmm0
75 ; CHECK-NEXT: cvtsd2ss %xmm0
76 ; CHECK-NEXT: shufpd
77 ; CHECK-NEXT: cvtsd2ss %xmm0
78 ; CHECK-NEXT: movap
79 ; CHECK-NEXT: jmp
80
81  %0 = tail call <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double> %a) nounwind
82  %a0 = extractelement <2 x double> %0, i32 0
83  %conv = fptrunc double %a0 to float
84  %a1 = extractelement <2 x double> %0, i32 1
85  %conv3 = fptrunc double %a1 to float
86  tail call void @callee2(float %conv, float %conv3) nounwind
87  ret void
88 }
89
90 declare void @callee2(float, float)
91 declare <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double>) nounwind readnone
92