blob: 9e691a3b55fc15383e1356d3a668077c4591f6e8 [file] [log] [blame]
Wouter van Oortmerssen8a9cb242018-08-27 15:45:51 +00001; RUN: llc < %s -asm-verbose=false -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s
Vadim Chugunove6f76552017-07-05 22:01:49 +00002; Test that UMULO works correctly on 64-bit operands.
3target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
Sam Clegga5908002018-05-10 17:49:11 +00004target triple = "wasm32-unknown-unknown"
Vadim Chugunove6f76552017-07-05 22:01:49 +00005
6; CHECK-LABEL: _ZN4core3num21_$LT$impl$u20$u64$GT$15overflowing_mul17h07be88b4cbac028fE:
7; CHECK: __multi3
8; Function Attrs: inlinehint
9define void @"_ZN4core3num21_$LT$impl$u20$u64$GT$15overflowing_mul17h07be88b4cbac028fE"(i64, i64) unnamed_addr #0 {
10start:
11 %2 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %0, i64 %1)
12 %3 = extractvalue { i64, i1 } %2, 0
13 store i64 %3, i64* undef
14 unreachable
15}
16
17; Function Attrs: nounwind readnone speculatable
18declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #1
19
20attributes #0 = { inlinehint }
21attributes #1 = { nounwind readnone speculatable }
Jatin Bhatejaaaa59442017-11-10 16:26:04 +000022
23; CHECK-LABEL: wut:
Sam Clegg275d15e2019-02-23 00:07:39 +000024; CHECK: call __multi3, $2, $0, $pop0, $1, $pop7
Jatin Bhatejaaaa59442017-11-10 16:26:04 +000025; CHECK: i64.load $0=, 8($2)
26define i1 @wut(i64, i64) {
27start:
28 %2 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %0, i64 %1)
29 %3 = extractvalue { i64, i1 } %2, 1
30 ret i1 %3
31}
32