1 ; RUN: llc < %s -O0 -wasm-disable-explicit-locals -wasm-keep-registers -asm-verbose=false | FileCheck %s
3 target triple = "wasm32-unknown-unknown"
5 declare void @foo(i128)
7 ; CHECK-LABEL: test_zext:
8 ; CHECK-NEXT: .functype test_zext (i32) -> (){{$}}
9 ; CHECK-NEXT: i64.extend_i32_u $[[TMP3:[0-9]+]]=, $0{{$}}
10 ; CHECK-NEXT: i64.const $[[TMP4:[0-9]+]]=, 1{{$}}
11 ; CHECK-NEXT: i64.and $[[TMP1:[0-9]+]]=, $[[TMP3]], $[[TMP4]]{{$}}
12 ; CHECK-NEXT: i64.const $[[TMP2:[0-9]+]]=, 0{{$}}
13 ; CHECK-NEXT: call foo, $[[TMP1]], $[[TMP2]]{{$}}
14 ; CHECK-NEXT: return{{$}}
15 define void @test_zext(i1 %b) nounwind {
16 %res = zext i1 %b to i128
19 next: ; preds = %start
20 call void @foo(i128 %res)
24 ; CHECK-LABEL: test_sext:
25 ; CHECK-NEXT:.functype test_sext (i32) -> (){{$}}
26 ; CHECK-NEXT: i64.extend_i32_u $[[TMP3:[0-9]+]]=, $0{{$}}
27 ; CHECK-NEXT: i64.const $[[TMP4:[0-9]+]]=, 1{{$}}
28 ; CHECK-NEXT: i64.and $[[TMP5:[0-9]+]]=, $[[TMP3]], $[[TMP4]]{{$}}
29 ; CHECK-NEXT: i64.const $[[TMP6:[0-9]+]]=, 0{{$}}
30 ; CHECK-NEXT: i64.sub $[[TMP1:[0-9]+]]=, $[[TMP6]], $[[TMP5]]{{$}}
31 ; CHECK-NEXT: local.copy $[[TMP2:[0-9]+]]=, $[[TMP1]]{{$}}
32 ; CHECK-NEXT: call foo, $[[TMP1]], $[[TMP2]]{{$}}
33 ; CHECK-NEXT: return{{$}}
34 define void @test_sext(i1 %b) nounwind {
35 %res = sext i1 %b to i128
38 next: ; preds = %start
39 call void @foo(i128 %res)