1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[AArch64] Add missing intrinsics for scalar FP rounding

Differential Revision: https://reviews.llvm.org/D98269
This commit is contained in:
Jingu Kang 2021-03-09 17:00:13 +00:00
parent aa8030a6bf
commit 0747239149
3 changed files with 100 additions and 4 deletions

View File

@ -44,6 +44,19 @@ def int_aarch64_fjcvtzs : DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_double_ty],
def int_aarch64_cls: DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoMem]>;
def int_aarch64_cls64: DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i64_ty], [IntrNoMem]>;
def int_aarch64_frint32z
: DefaultAttrsIntrinsic<[ llvm_anyfloat_ty ], [ LLVMMatchType<0> ],
[ IntrNoMem ]>;
def int_aarch64_frint64z
: DefaultAttrsIntrinsic<[ llvm_anyfloat_ty ], [ LLVMMatchType<0> ],
[ IntrNoMem ]>;
def int_aarch64_frint32x
: DefaultAttrsIntrinsic<[ llvm_anyfloat_ty ], [ LLVMMatchType<0> ],
[ IntrNoMem ]>;
def int_aarch64_frint64x
: DefaultAttrsIntrinsic<[ llvm_anyfloat_ty ], [ LLVMMatchType<0> ],
[ IntrNoMem ]>;
//===----------------------------------------------------------------------===//
// HINT

View File

@ -3805,10 +3805,10 @@ defm FSQRT : SingleOperandFPData<0b0011, "fsqrt", fsqrt>;
}
let Predicates = [HasFRInt3264] in {
defm FRINT32Z : FRIntNNT<0b00, "frint32z">;
defm FRINT64Z : FRIntNNT<0b10, "frint64z">;
defm FRINT32X : FRIntNNT<0b01, "frint32x">;
defm FRINT64X : FRIntNNT<0b11, "frint64x">;
defm FRINT32Z : FRIntNNT<0b00, "frint32z", int_aarch64_frint32z>;
defm FRINT64Z : FRIntNNT<0b10, "frint64z", int_aarch64_frint64z>;
defm FRINT32X : FRIntNNT<0b01, "frint32x", int_aarch64_frint32x>;
defm FRINT64X : FRIntNNT<0b11, "frint64x", int_aarch64_frint64x>;
} // HasFRInt3264
let Predicates = [HasFullFP16] in {

View File

@ -0,0 +1,83 @@
; RUN: llc < %s -mtriple=aarch64-eabi -mattr=+v8.5a | FileCheck %s
declare float @llvm.aarch64.frint32z.f32(float)
declare double @llvm.aarch64.frint32z.f64(double)
declare float @llvm.aarch64.frint64z.f32(float)
declare double @llvm.aarch64.frint64z.f64(double)
define dso_local float @t_frint32z(float %a) {
; CHECK-LABEL: t_frint32z:
; CHECK: frint32z s0, s0
; CHECK-NEXT: ret
entry:
%val = tail call float @llvm.aarch64.frint32z.f32(float %a)
ret float %val
}
define dso_local double @t_frint32zf(double %a) {
; CHECK-LABEL: t_frint32zf:
; CHECK: frint32z d0, d0
; CHECK-NEXT: ret
entry:
%val = tail call double @llvm.aarch64.frint32z.f64(double %a)
ret double %val
}
define dso_local float @t_frint64z(float %a) {
; CHECK-LABEL: t_frint64z:
; CHECK: frint64z s0, s0
; CHECK-NEXT: ret
entry:
%val = tail call float @llvm.aarch64.frint64z.f32(float %a)
ret float %val
}
define dso_local double @t_frint64zf(double %a) {
; CHECK-LABEL: t_frint64zf:
; CHECK: frint64z d0, d0
; CHECK-NEXT: ret
entry:
%val = tail call double @llvm.aarch64.frint64z.f64(double %a)
ret double %val
}
declare float @llvm.aarch64.frint32x.f32(float)
declare double @llvm.aarch64.frint32x.f64(double)
declare float @llvm.aarch64.frint64x.f32(float)
declare double @llvm.aarch64.frint64x.f64(double)
define dso_local float @t_frint32x(float %a) {
; CHECK-LABEL: t_frint32x:
; CHECK: frint32x s0, s0
; CHECK-NEXT: ret
entry:
%val = tail call float @llvm.aarch64.frint32x.f32(float %a)
ret float %val
}
define dso_local double @t_frint32xf(double %a) {
; CHECK-LABEL: t_frint32xf:
; CHECK: frint32x d0, d0
; CHECK-NEXT: ret
entry:
%val = tail call double @llvm.aarch64.frint32x.f64(double %a)
ret double %val
}
define dso_local float @t_frint64x(float %a) {
; CHECK-LABEL: t_frint64x:
; CHECK: frint64x s0, s0
; CHECK-NEXT: ret
entry:
%val = tail call float @llvm.aarch64.frint64x.f32(float %a)
ret float %val
}
define dso_local double @t_frint64xf(double %a) {
; CHECK-LABEL: t_frint64xf:
; CHECK: frint64x d0, d0
; CHECK-NEXT: ret
entry:
%val = tail call double @llvm.aarch64.frint64x.f64(double %a)
ret double %val
}