llvm.org GIT mirror llvm / 40486d7
[WebAssembly] Call signExtend to get sign extended register Patch by Jatin Bhateja! Differential Revision: https://reviews.llvm.org/D39529 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317710 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 1 year, 11 months ago
2 changed file(s) with 23 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
540540 unsigned WebAssemblyFastISel::getRegForSignedValue(const Value *V) {
541541 MVT::SimpleValueType From = getSimpleType(V->getType());
542542 MVT::SimpleValueType To = getLegalType(From);
543 return zeroExtend(getRegForValue(V), V, From, To);
543 return signExtend(getRegForValue(V), V, From, To);
544544 }
545545
546546 unsigned WebAssemblyFastISel::getRegForPromotedValue(const Value *V,
0 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
1 ; RUN: llc < %s -march=wasm32 | FileCheck %s
2
3 declare i32 @get_int(i16 %arg)
4
5 define i32 @func_1(i16 %arg1 , i32 %arg2) #0 {
6 ; CHECK-LABEL: func_1:
7 ; CHECK: # BB#0: # %entry
8 ; CHECK-NEXT: i32.const $push1=, 16
9 ; CHECK-NEXT: i32.shl $push2=, $0, $pop1
10 ; CHECK-NEXT: i32.const $push4=, 16
11 ; CHECK-NEXT: i32.shr_s $push3=, $pop2, $pop4
12 ; CHECK-NEXT: i32.call $push0=, get_int@FUNCTION, $pop3
13 ; CHECK-NEXT: # fallthrough-return: $pop0
14 ; CHECK-NEXT: .endfunc
15 entry:
16 %retval = call i32 @get_int(i16 signext %arg1)
17 ret i32 %retval
18 }
19
20 attributes #0 = {noinline nounwind optnone}
21