mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-12-19 11:23:32 +00:00
X86: support fpext/fptrunc operations to and from 16-bit floats.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213374 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -25,3 +25,45 @@ define void @test_bitcast_to_half(half* %addr, i16 %in) {
|
||||
store half %val_fp, half* %addr
|
||||
ret void
|
||||
}
|
||||
|
||||
define float @test_extend32(half* %addr) {
|
||||
; CHECK-LABEL: test_extend32:
|
||||
|
||||
; CHECK-LIBCALL: jmp __gnu_h2f_ieee
|
||||
; CHECK-FP16: vcvtph2ps
|
||||
%val16 = load half* %addr
|
||||
%val32 = fpext half %val16 to float
|
||||
ret float %val32
|
||||
}
|
||||
|
||||
define double @test_extend64(half* %addr) {
|
||||
; CHECK-LABEL: test_extend64:
|
||||
|
||||
; CHECK-LIBCALL: callq __gnu_h2f_ieee
|
||||
; CHECK-LIBCALL: cvtss2sd
|
||||
; CHECK-FP16: vcvtph2ps
|
||||
; CHECK-FP16: vcvtss2sd
|
||||
%val16 = load half* %addr
|
||||
%val32 = fpext half %val16 to double
|
||||
ret double %val32
|
||||
}
|
||||
|
||||
define void @test_trunc32(float %in, half* %addr) {
|
||||
; CHECK-LABEL: test_trunc32:
|
||||
|
||||
; CHECK-LIBCALL: callq __gnu_f2h_ieee
|
||||
; CHECK-FP16: vcvtps2ph
|
||||
%val16 = fptrunc float %in to half
|
||||
store half %val16, half* %addr
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @test_trunc64(double %in, half* %addr) {
|
||||
; CHECK-LABEL: test_trunc64:
|
||||
|
||||
; CHECK-LIBCALL: callq __truncdfhf2
|
||||
; CHECK-FP16: callq __truncdfhf2
|
||||
%val16 = fptrunc double %in to half
|
||||
store half %val16, half* %addr
|
||||
ret void
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user