1; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt | FileCheck %s 2 3; Test various types and operators that need to be legalized. 4 5target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" 6target triple = "wasm32-unknown-unknown" 7 8; CHECK-LABEL: shl_i3: 9; CHECK: i32.const $push0=, 7{{$}} 10; CHECK: i32.and $push1=, $1, $pop0{{$}} 11; CHECK: i32.shl $push2=, $0, $pop1{{$}} 12define i3 @shl_i3(i3 %a, i3 %b, i3* %p) { 13 %t = shl i3 %a, %b 14 ret i3 %t 15} 16 17; CHECK-LABEL: shl_i53: 18; CHECK: i64.const $push0=, 9007199254740991{{$}} 19; CHECK: i64.and $push1=, $1, $pop0{{$}} 20; CHECK: i64.shl $push2=, $0, $pop1{{$}} 21define i53 @shl_i53(i53 %a, i53 %b, i53* %p) { 22 %t = shl i53 %a, %b 23 ret i53 %t 24} 25 26; CHECK-LABEL: sext_in_reg_i32_i64: 27; CHECK: i64.shl 28; CHECK: i64.shr_s 29define i64 @sext_in_reg_i32_i64(i64 %a) { 30 %b = shl i64 %a, 32 31 %c = ashr i64 %b, 32 32 ret i64 %c 33} 34 35; CHECK-LABEL: fpext_f32_f64: 36; CHECK: f32.load $push0=, 0($0){{$}} 37; CHECK: f64.promote/f32 $push1=, $pop0{{$}} 38; CHECK: return $pop1{{$}} 39define double @fpext_f32_f64(float *%p) { 40 %v = load float, float* %p 41 %e = fpext float %v to double 42 ret double %e 43} 44 45; CHECK-LABEL: fpconv_f64_f32: 46; CHECK: f64.load $push0=, 0($0){{$}} 47; CHECK: f32.demote/f64 $push1=, $pop0{{$}} 48; CHECK: return $pop1{{$}} 49define float @fpconv_f64_f32(double *%p) { 50 %v = load double, double* %p 51 %e = fptrunc double %v to float 52 ret float %e 53} 54 55; Check that big shifts work. This generates a big pile of code from the 56; legalizer; the main thing here is that we don't abort. 57 58; CHECK-LABEL: bigshift: 59define i1024 @bigshift(i1024 %a, i1024 %b) { 60 %c = shl i1024 %a, %b 61 ret i1024 %c 62} 63