• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -O0 -wasm-disable-explicit-locals -wasm-keep-registers -asm-verbose=false | FileCheck %s
2
3target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
4target triple = "wasm32-unknown-unknown"
5
6declare void @foo(i128)
7
8; CHECK-LABEL: test_zext:
9; CHECK-NEXT: .functype test_zext (i32) -> (){{$}}
10; CHECK-NEXT: i64.extend_i32_u $[[TMP3:[0-9]+]]=, $0{{$}}
11; CHECK-NEXT: i64.const $[[TMP4:[0-9]+]]=, 1{{$}}
12; CHECK-NEXT: i64.and $[[TMP1:[0-9]+]]=, $[[TMP3]], $[[TMP4]]{{$}}
13; CHECK-NEXT: i64.const $[[TMP2:[0-9]+]]=, 0{{$}}
14; CHECK-NEXT: call foo, $[[TMP1]], $[[TMP2]]{{$}}
15; CHECK-NEXT: return{{$}}
16define void @test_zext(i1 %b) nounwind {
17  %res = zext i1 %b to i128
18  br label %next
19
20next:                                             ; preds = %start
21  call void @foo(i128 %res)
22  ret void
23}
24
25; CHECK-LABEL: test_sext:
26; CHECK-NEXT:.functype test_sext (i32) -> (){{$}}
27; CHECK-NEXT: i64.extend_i32_u $[[TMP3:[0-9]+]]=, $0{{$}}
28; CHECK-NEXT: i64.const $[[TMP4:[0-9]+]]=, 1{{$}}
29; CHECK-NEXT: i64.and $[[TMP5:[0-9]+]]=, $[[TMP3]], $[[TMP4]]{{$}}
30; CHECK-NEXT: i64.const $[[TMP6:[0-9]+]]=, 0{{$}}
31; CHECK-NEXT: i64.sub $[[TMP1:[0-9]+]]=, $[[TMP6]], $[[TMP5]]{{$}}
32; CHECK-NEXT: local.copy $[[TMP2:[0-9]+]]=, $[[TMP1]]{{$}}
33; CHECK-NEXT: call foo, $[[TMP1]], $[[TMP2]]{{$}}
34; CHECK-NEXT: return{{$}}
35define void @test_sext(i1 %b) nounwind {
36  %res = sext i1 %b to i128
37  br label %next
38
39next:                                             ; preds = %start
40  call void @foo(i128 %res)
41  ret void
42}
43