1 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -mattr=+sse4.2 < %s | FileCheck %s
4 ; CHECK: movss {{.*}}, %[[XMM0:xmm[0-9]+]]
5 ; CHECK: xorps %[[XMM1:xmm[0-9]+]], %[[XMM1]]
6 ; CHECK: roundss $9, %[[XMM0]], %[[XMM1]]
8 define void @testss(ptr nocapture %a, ptr nocapture %b, i32 %k) {
13 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
14 %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv
15 %v = load float, ptr %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, ptr %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
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]]
35 define void @testsd(ptr nocapture %a, ptr nocapture %b, i32 %k) {
40 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
41 %arrayidx = getelementptr inbounds double, ptr %a, i64 %indvars.iv
42 %v = load double, ptr %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, ptr %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
57 declare float @floorf(float) nounwind readnone
59 declare double @floor(double) nounwind readnone