1; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt | FileCheck %s
2
3; Test that f16 is expanded.
4
5target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
6target triple = "wasm32-unknown-unknown-wasm"
7
8; CHECK-LABEL: demote:
9; CHECK-NEXT: .param  	f32{{$}}
10; CHECK-NEXT: .result 	f32{{$}}
11; CHECK-NEXT: get_local	$push[[L0:[0-9]+]]=, 0{{$}}
12; CHECK-NEXT: i32.call	$push[[L1:[0-9]+]]=, __gnu_f2h_ieee@FUNCTION, $pop[[L0]]{{$}}
13; CHECK-NEXT: f32.call	$push[[L2:[0-9]+]]=, __gnu_h2f_ieee@FUNCTION, $pop[[L1]]{{$}}
14; CHECK-NEXT: return  	$pop[[L2]]{{$}}
15define half @demote(float %f) {
16    %t = fptrunc float %f to half
17    ret half %t
18}
19
20; CHECK-LABEL: promote:
21; CHECK-NEXT: .param  	f32{{$}}
22; CHECK-NEXT: .result 	f32{{$}}
23; CHECK-NEXT: get_local	$push0=, 0{{$}}
24; CHECK-NEXT: return  	$pop0{{$}}
25define float @promote(half %f) {
26    %t = fpext half %f to float
27    ret float %t
28}
29