blob: d40dbb27e7127b71c12aa5547f73981567035a57 [file] [log] [blame]
Wouter van Oortmerssen8a9cb242018-08-27 15:45:51 +00001; 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
Dan Gohmana63e8eb2017-02-22 16:28:00 +00003
4; Test that f16 is expanded.
5
6target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
Sam Clegga5908002018-05-10 17:49:11 +00007target triple = "wasm32-unknown-unknown"
Dan Gohmana63e8eb2017-02-22 16:28:00 +00008
9; CHECK-LABEL: demote:
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000010; CHECK-NEXT: .functype demote (f32) -> (f32){{$}}
Thomas Lively6a87dda2019-01-08 06:25:55 +000011; CHECK-NEXT: local.get $push[[L0:[0-9]+]]=, 0{{$}}
Sam Clegg275d15e2019-02-23 00:07:39 +000012; CHECK-NEXT: i32.call $push[[L1:[0-9]+]]=, __gnu_f2h_ieee, $pop[[L0]]{{$}}
13; CHECK-NEXT: f32.call $push[[L2:[0-9]+]]=, __gnu_h2f_ieee, $pop[[L1]]{{$}}
Dan Gohmana63e8eb2017-02-22 16:28:00 +000014; 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:
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000021; CHECK-NEXT: .functype promote (f32) -> (f32){{$}}
Thomas Lively6a87dda2019-01-08 06:25:55 +000022; CHECK-NEXT: local.get $push0=, 0{{$}}
Dan Gohmana63e8eb2017-02-22 16:28:00 +000023; CHECK-NEXT: return $pop0{{$}}
24define float @promote(half %f) {
25 %t = fpext half %f to float
26 ret float %t
27}