• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=x86_64-pc-linux-gnu -mattr=+sse4.2 < %s | FileCheck %s
2
3; CHECK-LABEL: testss:
4; CHECK: movss {{.*}}, %[[XMM0:xmm[0-9]+]]
5; CHECK: xorps %[[XMM1:xmm[0-9]+]], %[[XMM1]]
6; CHECK: roundss $9, %[[XMM0]], %[[XMM1]]
7
8define void @testss(float* nocapture %a, <4 x float>* nocapture %b, i32 %k) {
9entry:
10  br label %for.body
11
12for.body:
13  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
14  %arrayidx = getelementptr inbounds float, float* %a, i64 %indvars.iv
15  %v = load float, float* %arrayidx, align 4
16  %floor = call float @floorf(float %v)
17  %sub = fsub float %floor, %v
18  %v1 = insertelement <4 x float> undef, float %sub, i32 0
19  %br = shufflevector <4 x float> %v1, <4 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
20  store volatile <4 x float> %br, <4 x float>* %b, align 4
21  %indvars.iv.next = add i64 %indvars.iv, 1
22  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
23  %exitcond = icmp eq i32 %lftr.wideiv, %k
24  br i1 %exitcond, label %for.end, label %for.body
25
26for.end:
27  ret void
28}
29
30; CHECK-LABEL: testsd:
31; CHECK: movsd {{.*}}, %[[XMM0:xmm[0-9]+]]
32; CHECK: xorps %[[XMM1:xmm[0-9]+]], %[[XMM1]]
33; CHECK: roundsd $9, %[[XMM0]], %[[XMM1]]
34
35define void @testsd(double* nocapture %a, <2 x double>* nocapture %b, i32 %k) {
36entry:
37  br label %for.body
38
39for.body:
40  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
41  %arrayidx = getelementptr inbounds double, double* %a, i64 %indvars.iv
42  %v = load double, double* %arrayidx, align 4
43  %floor = call double @floor(double %v)
44  %sub = fsub double %floor, %v
45  %v1 = insertelement <2 x double> undef, double %sub, i32 0
46  %br = shufflevector <2 x double> %v1, <2 x double> undef, <2 x i32> <i32 0, i32 0>
47  store volatile <2 x double> %br, <2 x double>* %b, align 4
48  %indvars.iv.next = add i64 %indvars.iv, 1
49  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
50  %exitcond = icmp eq i32 %lftr.wideiv, %k
51  br i1 %exitcond, label %for.end, label %for.body
52
53for.end:
54  ret void
55}
56
57declare float @floorf(float) nounwind readnone
58
59declare double @floor(double) nounwind readnone
60
61