1; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers | FileCheck %s 2; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -fast-isel | FileCheck %s 3 4; Test that f16 is expanded. 5 6target triple = "wasm32-unknown-unknown" 7 8; CHECK-LABEL: demote.f32: 9; CHECK-NEXT: .functype demote.f32 (f32) -> (f32){{$}} 10; CHECK-NEXT: local.get $push[[L0:[0-9]+]]=, 0{{$}} 11; CHECK-NEXT: call $push[[L1:[0-9]+]]=, __truncsfhf2, $pop[[L0]]{{$}} 12; CHECK-NEXT: call $push[[L2:[0-9]+]]=, __extendhfsf2, $pop[[L1]]{{$}} 13; CHECK-NEXT: return $pop[[L2]]{{$}} 14define half @demote.f32(float %f) { 15 %t = fptrunc float %f to half 16 ret half %t 17} 18 19; CHECK-LABEL: promote.f32: 20; CHECK-NEXT: .functype promote.f32 (f32) -> (f32){{$}} 21; CHECK-NEXT: local.get $push0=, 0{{$}} 22; CHECK-NEXT: return $pop0{{$}} 23define float @promote.f32(half %f) { 24 %t = fpext half %f to float 25 ret float %t 26} 27 28; CHECK-LABEL: demote.f64: 29; CHECK-NEXT: .functype demote.f64 (f64) -> (f32){{$}} 30; CHECK-NEXT: local.get $push[[L0:[0-9]+]]=, 0{{$}} 31; CHECK-NEXT: call $push[[L1:[0-9]+]]=, __truncdfhf2, $pop[[L0]]{{$}} 32; CHECK-NEXT: call $push[[L2:[0-9]+]]=, __extendhfsf2, $pop[[L1]]{{$}} 33; CHECK-NEXT: return $pop[[L2]]{{$}} 34define half @demote.f64(double %f) { 35 %t = fptrunc double %f to half 36 ret half %t 37} 38 39; CHECK-LABEL: promote.f64: 40; CHECK-NEXT: .functype promote.f64 (f32) -> (f64){{$}} 41; CHECK-NEXT: local.get $push[[L0:[0-9]+]]=, 0{{$}} 42; CHECK-NEXT: f64.promote_f32 $push[[L1:[0-9]+]]=, $pop[[L0]]{{$}} 43; CHECK-NEXT: return $pop[[L1]]{{$}} 44define double @promote.f64(half %f) { 45 %t = fpext half %f to double 46 ret double %t 47} 48 49; CHECK-LABEL: demote.f128: 50; CHECK-NEXT: .functype demote.f128 (i64, i64) -> (f32){{$}} 51; CHECK-NEXT: local.get $push[[L0:[0-9]+]]=, 0{{$}} 52; CHECK-NEXT: local.get $push[[L1:[0-9]+]]=, 1{{$}} 53; CHECK-NEXT: call $push[[L2:[0-9]+]]=, __trunctfhf2, $pop[[L0]], $pop[[L1]]{{$}} 54; CHECK-NEXT: call $push[[L3:[0-9]+]]=, __extendhfsf2, $pop[[L2]]{{$}} 55; CHECK-NEXT: return $pop[[L3]]{{$}} 56define half @demote.f128(fp128 %f) { 57 %t = fptrunc fp128 %f to half 58 ret half %t 59} 60 61; CHECK-LABEL: promote.f128: 62; CHECK-NEXT: .functype promote.f128 (i32, f32) -> (){{$}} 63; CHECK: call __extendsftf2 64; CHECK: i64.store 65; CHECK: i64.store 66define fp128 @promote.f128(half %f) { 67 %t = fpext half %f to fp128 68 ret fp128 %t 69} 70