Add a neat little two's complement hack for x86.
[oota-llvm.git] / test / CodeGen / X86 / avx-128.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
2
3 @z = common global <4 x float> zeroinitializer, align 16
4
5 define void @zero() nounwind ssp {
6 entry:
7   ; CHECK: vxorps
8   ; CHECK: vmovaps
9   store <4 x float> zeroinitializer, <4 x float>* @z, align 16
10   ret void
11 }
12
13 define void @fpext() nounwind uwtable {
14 entry:
15   %f = alloca float, align 4
16   %d = alloca double, align 8
17   %tmp = load float* %f, align 4
18   ; CHECK: vcvtss2sd
19   %conv = fpext float %tmp to double
20   store double %conv, double* %d, align 8
21   ret void
22 }
23
24 ; CHECK: vcvtsi2sdq (%
25 define double @funcA(i64* nocapture %e) nounwind uwtable readonly ssp {
26 entry:
27   %tmp1 = load i64* %e, align 8
28   %conv = sitofp i64 %tmp1 to double
29   ret double %conv
30 }
31
32 ; CHECK: vcvtsi2sd (%
33 define double @funcB(i32* nocapture %e) nounwind uwtable readonly ssp {
34 entry:
35   %tmp1 = load i32* %e, align 4
36   %conv = sitofp i32 %tmp1 to double
37   ret double %conv
38 }
39
40 ; CHECK: vcvtsi2ss (%
41 define float @funcC(i32* nocapture %e) nounwind uwtable readonly ssp {
42 entry:
43   %tmp1 = load i32* %e, align 4
44   %conv = sitofp i32 %tmp1 to float
45   ret float %conv
46 }
47
48 ; CHECK: vcvtsi2ssq  (%
49 define float @funcD(i64* nocapture %e) nounwind uwtable readonly ssp {
50 entry:
51   %tmp1 = load i64* %e, align 8
52   %conv = sitofp i64 %tmp1 to float
53   ret float %conv
54 }
55
56 ; CHECK: vsqrtss
57 define float @sqrtA(float %a) nounwind uwtable readnone ssp {
58 entry:
59   %conv1 = tail call float @sqrtf(float %a) nounwind readnone
60   ret float %conv1
61 }
62
63 declare double @sqrt(double) readnone
64
65 ; CHECK: vsqrtsd
66 define double @sqrtB(double %a) nounwind uwtable readnone ssp {
67 entry:
68   %call = tail call double @sqrt(double %a) nounwind readnone
69   ret double %call
70 }
71
72 declare float @sqrtf(float) readnone