summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/scalar_widen_div.ll
diff options
context:
space:
mode:
authorMon P Wang <wangmp@apple.com>2010-02-10 23:37:45 +0000
committerMon P Wang <wangmp@apple.com>2010-02-10 23:37:45 +0000
commitf7ea6c3ee89e605c8d0bb7cdb0ade79706c750e8 (patch)
tree5b933600bbd252a8a3f242e5ae9b3d49c42813a9 /test/CodeGen/X86/scalar_widen_div.ll
parent99efcf299fb522297dee43066f9c19df00813dcb (diff)
downloadllvm-f7ea6c3ee89e605c8d0bb7cdb0ade79706c750e8.tar.gz
llvm-f7ea6c3ee89e605c8d0bb7cdb0ade79706c750e8.tar.bz2
llvm-f7ea6c3ee89e605c8d0bb7cdb0ade79706c750e8.tar.xz
The previous fix of widening divides that trap was too fragile as it depends on custom
lowering and requires that certain types exist in ValueTypes.h. Modified widening to check if an op can trap and if so, the widening algorithm will apply only the op on the defined elements. It is safer to do this in widening because the optimizer can't guarantee removing unused ops in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95823 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/scalar_widen_div.ll')
-rw-r--r--test/CodeGen/X86/scalar_widen_div.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/CodeGen/X86/scalar_widen_div.ll b/test/CodeGen/X86/scalar_widen_div.ll
index fc67e4417c..77f320f105 100644
--- a/test/CodeGen/X86/scalar_widen_div.ll
+++ b/test/CodeGen/X86/scalar_widen_div.ll
@@ -152,3 +152,32 @@ define <5 x i64> @test_ulong_rem(<5 x i64> %num, <5 x i64> %rem) {
%rem.r = urem <5 x i64> %num, %rem
ret <5 x i64> %rem.r
}
+
+define void @test_int_div(<3 x i32>* %dest, <3 x i32>* %old, i32 %n) {
+; CHECK: idivl
+; CHECK: idivl
+; CHECK: idivl
+; CHECK-NOT: idivl
+; CHECK: ret
+entry:
+ %cmp13 = icmp sgt i32 %n, 0
+ br i1 %cmp13, label %bb.nph, label %for.end
+
+bb.nph:
+ br label %for.body
+
+for.body:
+ %i.014 = phi i32 [ 0, %bb.nph ], [ %inc, %for.body ]
+ %arrayidx11 = getelementptr <3 x i32>* %dest, i32 %i.014
+ %tmp4 = load <3 x i32>* %arrayidx11 ; <<3 x i32>> [#uses=1]
+ %arrayidx7 = getelementptr inbounds <3 x i32>* %old, i32 %i.014
+ %tmp8 = load <3 x i32>* %arrayidx7 ; <<3 x i32>> [#uses=1]
+ %div = sdiv <3 x i32> %tmp4, %tmp8
+ store <3 x i32> %div, <3 x i32>* %arrayidx11
+ %inc = add nsw i32 %i.014, 1
+ %exitcond = icmp eq i32 %inc, %n
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}