blob: 85b6bd244090ae22954a1760e1a411eda51675bd [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s
; Test that UMULO works correctly on 64-bit operands.
target triple = "wasm32-unknown-unknown"
; Function Attrs: inlinehint
define void @"_ZN4core3num21_$LT$impl$u20$u64$GT$15overflowing_mul17h07be88b4cbac028fE"(i64, i64) unnamed_addr #0 {
; CHECK-LABEL: _ZN4core3num21_$LT$impl$u20$u64$GT$15overflowing_mul17h07be88b4cbac028fE:
; CHECK: .functype _ZN4core3num21_$LT$impl$u20$u64$GT$15overflowing_mul17h07be88b4cbac028fE (i64, i64) -> ()
; CHECK-NEXT: # %bb.0: # %start
; CHECK-NEXT: global.get $push2=, __stack_pointer
; CHECK-NEXT: i32.const $push3=, 16
; CHECK-NEXT: i32.sub $push6=, $pop2, $pop3
; CHECK-NEXT: local.tee $push5=, $2=, $pop6
; CHECK-NEXT: global.set __stack_pointer, $pop5
; CHECK-NEXT: i64.const $push0=, 0
; CHECK-NEXT: i64.const $push4=, 0
; CHECK-NEXT: call __multi3, $2, $0, $pop0, $1, $pop4
; CHECK-NEXT: i64.load $push1=, 0($2)
; CHECK-NEXT: i64.store 0($2), $pop1
; CHECK-NEXT: unreachable
start:
%2 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %0, i64 %1)
%3 = extractvalue { i64, i1 } %2, 0
store i64 %3, ptr undef
unreachable
}
; Function Attrs: nounwind readnone speculatable
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #1
attributes #0 = { inlinehint }
attributes #1 = { nounwind readnone speculatable }
define i1 @wut(i64, i64) {
; CHECK-LABEL: wut:
; CHECK: .functype wut (i64, i64) -> (i32)
; CHECK-NEXT: # %bb.0: # %start
; CHECK-NEXT: global.get $push2=, __stack_pointer
; CHECK-NEXT: i32.const $push3=, 16
; CHECK-NEXT: i32.sub $push9=, $pop2, $pop3
; CHECK-NEXT: local.tee $push8=, $2=, $pop9
; CHECK-NEXT: global.set __stack_pointer, $pop8
; CHECK-NEXT: i64.const $push0=, 0
; CHECK-NEXT: i64.const $push7=, 0
; CHECK-NEXT: call __multi3, $2, $0, $pop0, $1, $pop7
; CHECK-NEXT: i64.load $1=, 8($2)
; CHECK-NEXT: i32.const $push4=, 16
; CHECK-NEXT: i32.add $push5=, $2, $pop4
; CHECK-NEXT: global.set __stack_pointer, $pop5
; CHECK-NEXT: i64.const $push6=, 0
; CHECK-NEXT: i64.ne $push1=, $1, $pop6
; CHECK-NEXT: # fallthrough-return
start:
%2 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %0, i64 %1)
%3 = extractvalue { i64, i1 } %2, 1
ret i1 %3
}