summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly/muloti4.ll
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2018-05-31 22:27:24 +0000
committerDan Gohman <dan433584@gmail.com>2018-05-31 22:27:24 +0000
commitb17de645ea3b536ab3c12b3837fcca6ae25f0343 (patch)
tree7fc8064f8bbc172b09d3bfbef6975e13c75fec96 /llvm/test/CodeGen/WebAssembly/muloti4.ll
parent5ef4d5f9c1c18ea7e274172e6f43a23aa1b1da31 (diff)
downloadbcm5719-llvm-b17de645ea3b536ab3c12b3837fcca6ae25f0343.tar.gz
bcm5719-llvm-b17de645ea3b536ab3c12b3837fcca6ae25f0343.zip
[WebAssembly] Fix the signatures for the __mulo* libcalls.
The __mulo* libcalls have an extra i32* to return the overflow value. Fixes PR37401. llvm-svn: 333706
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly/muloti4.ll')
-rw-r--r--llvm/test/CodeGen/WebAssembly/muloti4.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/muloti4.ll b/llvm/test/CodeGen/WebAssembly/muloti4.ll
new file mode 100644
index 00000000000..1e403342869
--- /dev/null
+++ b/llvm/test/CodeGen/WebAssembly/muloti4.ll
@@ -0,0 +1,19 @@
+; RUN: llc -asm-verbose=false < %s | FileCheck %s
+
+; Test that 128-bit smul.with.overflow assembles as expected.
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+define i128 @call_muloti4(i128 %a, i128 %b) nounwind {
+entry:
+ %smul = tail call { i128, i1 } @llvm.smul.with.overflow.i128(i128 %a, i128 %b)
+ %cmp = extractvalue { i128, i1 } %smul, 1
+ %smul.result = extractvalue { i128, i1 } %smul, 0
+ %X = select i1 %cmp, i128 %smul.result, i128 42
+ ret i128 %X
+}
+
+; CHECK: call __muloti4@FUNCTION, $pop{{[0-9]*}}, $pop{{[0-9]*}}, $pop{{[0-9]*}}, $pop{{[0-9]*}}, $pop{{[0-9]*}}, $pop{{[0-9]*}}{{$}}
+
+declare { i128, i1 } @llvm.smul.with.overflow.i128(i128, i128) nounwind readnone
OpenPOWER on IntegriCloud