Adds a builtin and intrinsic for the f32.store_f16 instruction.
The instruction stores an f32 value as an f16 memory. Specified at:
29a9b9462c/proposals/half-precision/Overview.md
Note: the current spec has f32.store_f16 as opcode 0xFD0121, but this is
incorrect and will be changed to 0xFC31 soon.
22 lines
906 B
LLVM
22 lines
906 B
LLVM
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+half-precision | FileCheck %s
|
|
; RUN: llc < %s --mtriple=wasm64-unknown-unknown -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+half-precision | FileCheck %s
|
|
|
|
declare float @llvm.wasm.loadf32.f16(ptr)
|
|
declare void @llvm.wasm.storef16.f32(float, ptr)
|
|
|
|
; CHECK-LABEL: ldf16_32:
|
|
; CHECK: f32.load_f16 $push[[NUM0:[0-9]+]]=, 0($0){{$}}
|
|
; CHECK-NEXT: return $pop[[NUM0]]{{$}}
|
|
define float @ldf16_32(ptr %p) {
|
|
%v = call float @llvm.wasm.loadf16.f32(ptr %p)
|
|
ret float %v
|
|
}
|
|
|
|
; CHECK-LABEL: stf16_32:
|
|
; CHECK: f32.store_f16 0($1), $0
|
|
; CHECK-NEXT: return
|
|
define void @stf16_32(float %v, ptr %p) {
|
|
tail call void @llvm.wasm.storef16.f32(float %v, ptr %p)
|
|
ret void
|
|
}
|