61 lines · plain
1; RUN: llc -mtriple=x86_64-pc-linux-gnu -mattr=+sse4.2 < %s | FileCheck %s2 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(ptr nocapture %a, ptr nocapture %b, i32 %k) {9entry:10 br label %for.body11 12for.body:13 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]14 %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv15 %v = load float, ptr %arrayidx, align 416 %floor = call float @floorf(float %v)17 %sub = fsub float %floor, %v18 %v1 = insertelement <4 x float> undef, float %sub, i32 019 %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 421 %indvars.iv.next = add i64 %indvars.iv, 122 %lftr.wideiv = trunc i64 %indvars.iv.next to i3223 %exitcond = icmp eq i32 %lftr.wideiv, %k24 br i1 %exitcond, label %for.end, label %for.body25 26for.end:27 ret void28}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(ptr nocapture %a, ptr nocapture %b, i32 %k) {36entry:37 br label %for.body38 39for.body:40 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]41 %arrayidx = getelementptr inbounds double, ptr %a, i64 %indvars.iv42 %v = load double, ptr %arrayidx, align 443 %floor = call double @floor(double %v)44 %sub = fsub double %floor, %v45 %v1 = insertelement <2 x double> undef, double %sub, i32 046 %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 448 %indvars.iv.next = add i64 %indvars.iv, 149 %lftr.wideiv = trunc i64 %indvars.iv.next to i3250 %exitcond = icmp eq i32 %lftr.wideiv, %k51 br i1 %exitcond, label %for.end, label %for.body52 53for.end:54 ret void55}56 57declare float @floorf(float) nounwind readnone58 59declare double @floor(double) nounwind readnone60 61