1 ; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s
2 ; RUN: llc < %s --mtriple=wasm64-unknown-unknown -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s
4 ; Test that extending loads are assembled properly.
6 ; CHECK-LABEL: sext_i8_i32:
7 ; CHECK: i32.load8_s $push0=, 0($0){{$}}
8 ; CHECK-NEXT: return $pop0{{$}}
9 define i32 @sext_i8_i32(ptr %p) {
11 %e = sext i8 %v to i32
15 ; CHECK-LABEL: zext_i8_i32:
16 ; CHECK: i32.load8_u $push0=, 0($0){{$}}
17 ; CHECK-NEXT: return $pop0{{$}}
18 define i32 @zext_i8_i32(ptr %p) {
20 %e = zext i8 %v to i32
24 ; CHECK-LABEL: sext_i16_i32:
25 ; CHECK: i32.load16_s $push0=, 0($0){{$}}
26 ; CHECK-NEXT: return $pop0{{$}}
27 define i32 @sext_i16_i32(ptr %p) {
29 %e = sext i16 %v to i32
33 ; CHECK-LABEL: zext_i16_i32:
34 ; CHECK: i32.load16_u $push0=, 0($0){{$}}
35 ; CHECK-NEXT: return $pop0{{$}}
36 define i32 @zext_i16_i32(ptr %p) {
38 %e = zext i16 %v to i32
42 ; CHECK-LABEL: sext_i8_i64:
43 ; CHECK: i64.load8_s $push0=, 0($0){{$}}
44 ; CHECK-NEXT: return $pop0{{$}}
45 define i64 @sext_i8_i64(ptr %p) {
47 %e = sext i8 %v to i64
51 ; CHECK-LABEL: zext_i8_i64:
52 ; CHECK: i64.load8_u $push0=, 0($0){{$}}
53 ; CHECK-NEXT: return $pop0{{$}}
54 define i64 @zext_i8_i64(ptr %p) {
56 %e = zext i8 %v to i64
60 ; CHECK-LABEL: sext_i16_i64:
61 ; CHECK: i64.load16_s $push0=, 0($0){{$}}
62 ; CHECK-NEXT: return $pop0{{$}}
63 define i64 @sext_i16_i64(ptr %p) {
65 %e = sext i16 %v to i64
69 ; CHECK-LABEL: zext_i16_i64:
70 ; CHECK: i64.load16_u $push0=, 0($0){{$}}
71 ; CHECK-NEXT: return $pop0{{$}}
72 define i64 @zext_i16_i64(ptr %p) {
74 %e = zext i16 %v to i64
78 ; CHECK-LABEL: sext_i32_i64:
79 ; CHECK: i64.load32_s $push0=, 0($0){{$}}
80 ; CHECK-NEXT: return $pop0{{$}}
81 define i64 @sext_i32_i64(ptr %p) {
83 %e = sext i32 %v to i64
87 ; CHECK-LABEL: zext_i32_i64:
88 ; CHECK: i64.load32_u $push0=, 0($0){{$}}
89 ; CHECK: return $pop0{{$}}
90 define i64 @zext_i32_i64(ptr %p) {
92 %e = zext i32 %v to i64