summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-01-20 08:54:28 +0000
committerEric Christopher <echristo@apple.com>2011-01-20 08:54:28 +0000
commit785db078b49f66fd3ba880037867335c78d5e926 (patch)
treebfe76efeaa5091d569a5e3c9eb61808e69fdbcad /llvm/test/CodeGen
parent7af85533f8f3a3b47018f0982887767a117daafc (diff)
downloadbcm5719-llvm-785db078b49f66fd3ba880037867335c78d5e926.tar.gz
bcm5719-llvm-785db078b49f66fd3ba880037867335c78d5e926.zip
Expand invalid return values for umulo and smulo. Handle these similarly
to add/sub by doing the normal operation and then checking for overflow afterwards. This generally relies on the DAG handling the later invalid operations as well. Fixes the 64-bit part of rdar://8622122 and rdar://8774702. llvm-svn: 123908
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/umulo-64.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/umulo-64.ll b/llvm/test/CodeGen/X86/umulo-64.ll
new file mode 100644
index 00000000000..280bd9cb066
--- /dev/null
+++ b/llvm/test/CodeGen/X86/umulo-64.ll
@@ -0,0 +1,28 @@
+; RUN: llc < %s -mtriple=i386-apple-darwin
+
+%0 = type { i64, i1 }
+
+define i32 @f0(i64 %a, i64 %b) nounwind ssp {
+ %1 = alloca i64, align 4
+ %2 = alloca i64, align 4
+ store i64 %a, i64* %1, align 8
+ store i64 %b, i64* %2, align 8
+ %3 = load i64* %1, align 8
+ %4 = load i64* %2, align 8
+ %5 = call %0 @llvm.smul.with.overflow.i64(i64 %3, i64 %4)
+ %6 = extractvalue %0 %5, 0
+ %7 = extractvalue %0 %5, 1
+ br i1 %7, label %8, label %9
+
+; <label>:8 ; preds = %0
+ call void @llvm.trap()
+ unreachable
+
+; <label>:9 ; preds = %0
+ %10 = trunc i64 %6 to i32
+ ret i32 %10
+}
+
+declare %0 @llvm.smul.with.overflow.i64(i64, i64) nounwind readnone
+
+declare void @llvm.trap() nounwind
OpenPOWER on IntegriCloud