1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s 2 3 ; Test that extending loads are assembled properly. 4 5 target datalayout = "e-p:32:32-i64:64-n32:64-S128" 6 target triple = "wasm32-unknown-unknown" 7 8 ; CHECK-LABEL: sext_i8_i32: 9 ; CHECK: i32.load8_s $push0=, 0($0){{$}} 10 ; CHECK-NEXT: return $pop0{{$}} 11 define i32 @sext_i8_i32(i8 *%p) { 12 %v = load i8, i8* %p 13 %e = sext i8 %v to i32 14 ret i32 %e 15 } 16 17 ; CHECK-LABEL: zext_i8_i32: 18 ; CHECK: i32.load8_u $push0=, 0($0){{$}} 19 ; CHECK-NEXT: return $pop0{{$}} 20 define i32 @zext_i8_i32(i8 *%p) { 21 %v = load i8, i8* %p 22 %e = zext i8 %v to i32 23 ret i32 %e 24 } 25 26 ; CHECK-LABEL: sext_i16_i32: 27 ; CHECK: i32.load16_s $push0=, 0($0){{$}} 28 ; CHECK-NEXT: return $pop0{{$}} 29 define i32 @sext_i16_i32(i16 *%p) { 30 %v = load i16, i16* %p 31 %e = sext i16 %v to i32 32 ret i32 %e 33 } 34 35 ; CHECK-LABEL: zext_i16_i32: 36 ; CHECK: i32.load16_u $push0=, 0($0){{$}} 37 ; CHECK-NEXT: return $pop0{{$}} 38 define i32 @zext_i16_i32(i16 *%p) { 39 %v = load i16, i16* %p 40 %e = zext i16 %v to i32 41 ret i32 %e 42 } 43 44 ; CHECK-LABEL: sext_i8_i64: 45 ; CHECK: i64.load8_s $push0=, 0($0){{$}} 46 ; CHECK-NEXT: return $pop0{{$}} 47 define i64 @sext_i8_i64(i8 *%p) { 48 %v = load i8, i8* %p 49 %e = sext i8 %v to i64 50 ret i64 %e 51 } 52 53 ; CHECK-LABEL: zext_i8_i64: 54 ; CHECK: i64.load8_u $push0=, 0($0){{$}} 55 ; CHECK-NEXT: return $pop0{{$}} 56 define i64 @zext_i8_i64(i8 *%p) { 57 %v = load i8, i8* %p 58 %e = zext i8 %v to i64 59 ret i64 %e 60 } 61 62 ; CHECK-LABEL: sext_i16_i64: 63 ; CHECK: i64.load16_s $push0=, 0($0){{$}} 64 ; CHECK-NEXT: return $pop0{{$}} 65 define i64 @sext_i16_i64(i16 *%p) { 66 %v = load i16, i16* %p 67 %e = sext i16 %v to i64 68 ret i64 %e 69 } 70 71 ; CHECK-LABEL: zext_i16_i64: 72 ; CHECK: i64.load16_u $push0=, 0($0){{$}} 73 ; CHECK-NEXT: return $pop0{{$}} 74 define i64 @zext_i16_i64(i16 *%p) { 75 %v = load i16, i16* %p 76 %e = zext i16 %v to i64 77 ret i64 %e 78 } 79 80 ; CHECK-LABEL: sext_i32_i64: 81 ; CHECK: i64.load32_s $push0=, 0($0){{$}} 82 ; CHECK-NEXT: return $pop0{{$}} 83 define i64 @sext_i32_i64(i32 *%p) { 84 %v = load i32, i32* %p 85 %e = sext i32 %v to i64 86 ret i64 %e 87 } 88 89 ; CHECK-LABEL: zext_i32_i64: 90 ; CHECK: i64.load32_u $push0=, 0($0){{$}} 91 ; CHECK: return $pop0{{$}} 92 define i64 @zext_i32_i64(i32 *%p) { 93 %v = load i32, i32* %p 94 %e = zext i32 %v to i64 95 ret i64 %e 96 } 97