mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-03 02:30:00 +00:00
This makes the two intrinsics @llvm.convert.from.f16 and @llvm.convert.to.f16 accept types other than simple "float". This is only strictly needed for the truncate operation, since otherwise double rounding occurs and there's no way to represent the strict IEEE conversion. However, for symmetry we allow larger types in the extend too. During legalization, we can expand an "fp16_to_double" operation into two extends for convenience, but abort when the truncate isn't legal. A new libcall is probably needed here. Even after this commit, various target tweaks are needed to actually use the extended intrinsics. I've put these into separate commits for clarity, so there are no actual tests of f64 conversion here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213248 91177308-0d34-0410-b5e6-96231b3b80d8
33 lines
1.0 KiB
LLVM
33 lines
1.0 KiB
LLVM
; RUN: llc < %s | FileCheck %s
|
|
; RUN: llc -mattr=+vfp3,+fp16 < %s | FileCheck --check-prefix=CHECK-FP16 %s
|
|
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32"
|
|
target triple = "armv7-eabi"
|
|
|
|
@x = global i16 12902
|
|
@y = global i16 0
|
|
@z = common global i16 0
|
|
|
|
define arm_aapcs_vfpcc void @foo() nounwind {
|
|
; CHECK-LABEL: foo:
|
|
; CHECK-FP16-LABEL: foo:
|
|
entry:
|
|
%0 = load i16* @x, align 2
|
|
%1 = load i16* @y, align 2
|
|
%2 = tail call float @llvm.convert.from.fp16.f32(i16 %0)
|
|
; CHECK: __gnu_h2f_ieee
|
|
; CHECK-FP16: vcvtb.f32.f16
|
|
%3 = tail call float @llvm.convert.from.fp16.f32(i16 %1)
|
|
; CHECK: __gnu_h2f_ieee
|
|
; CHECK-FP16: vcvtb.f32.f16
|
|
%4 = fadd float %2, %3
|
|
%5 = tail call i16 @llvm.convert.to.fp16.f32(float %4)
|
|
; CHECK: __gnu_f2h_ieee
|
|
; CHECK-FP16: vcvtb.f16.f32
|
|
store i16 %5, i16* @x, align 2
|
|
ret void
|
|
}
|
|
|
|
declare float @llvm.convert.from.fp16.f32(i16) nounwind readnone
|
|
|
|
declare i16 @llvm.convert.to.fp16.f32(float) nounwind readnone
|