[llvm] r330011 - [NEON] Support intrinsic for scalar and vector versions of the VRINTN instruction
Ivan A. Kosarev via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 13 05:45:12 PDT 2018
Author: kosarev
Date: Fri Apr 13 05:45:12 2018
New Revision: 330011
URL: http://llvm.org/viewvc/llvm-project?rev=330011&view=rev
Log:
[NEON] Support intrinsic for scalar and vector versions of the VRINTN instruction
Differential Revision: https://reviews.llvm.org/D45514
Added:
llvm/trunk/test/CodeGen/ARM/vrint.ll
Modified:
llvm/trunk/include/llvm/IR/IntrinsicsARM.td
llvm/trunk/lib/Target/ARM/ARMInstrVFP.td
Modified: llvm/trunk/include/llvm/IR/IntrinsicsARM.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicsARM.td?rev=330011&r1=330010&r2=330011&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IntrinsicsARM.td (original)
+++ llvm/trunk/include/llvm/IR/IntrinsicsARM.td Fri Apr 13 05:45:12 2018
@@ -369,6 +369,10 @@ class Neon_3Arg_Long_Intrinsic
: Intrinsic<[llvm_anyvector_ty],
[LLVMMatchType<0>, LLVMTruncatedType<0>, LLVMTruncatedType<0>],
[IntrNoMem]>;
+
+class Neon_1FloatArg_Intrinsic
+ : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
+
class Neon_CvtFxToFP_Intrinsic
: Intrinsic<[llvm_anyfloat_ty], [llvm_anyint_ty, llvm_i32_ty], [IntrNoMem]>;
class Neon_CvtFPToFx_Intrinsic
@@ -591,8 +595,8 @@ def int_arm_neon_vtbx2 : Neon_Tbl4Arg_In
def int_arm_neon_vtbx3 : Neon_Tbl5Arg_Intrinsic;
def int_arm_neon_vtbx4 : Neon_Tbl6Arg_Intrinsic;
-// Vector Rounding
-def int_arm_neon_vrintn : Neon_1Arg_Intrinsic;
+// Vector and Scalar Rounding.
+def int_arm_neon_vrintn : Neon_1FloatArg_Intrinsic;
def int_arm_neon_vrintx : Neon_1Arg_Intrinsic;
def int_arm_neon_vrinta : Neon_1Arg_Intrinsic;
def int_arm_neon_vrintz : Neon_1Arg_Intrinsic;
Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=330011&r1=330010&r2=330011&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Fri Apr 13 05:45:12 2018
@@ -977,7 +977,7 @@ multiclass vrint_inst_anpm<string opc, b
}
defm VRINTA : vrint_inst_anpm<"a", 0b00, fround>;
-defm VRINTN : vrint_inst_anpm<"n", 0b01>;
+defm VRINTN : vrint_inst_anpm<"n", 0b01, int_arm_neon_vrintn>;
defm VRINTP : vrint_inst_anpm<"p", 0b10, fceil>;
defm VRINTM : vrint_inst_anpm<"m", 0b11, ffloor>;
Added: llvm/trunk/test/CodeGen/ARM/vrint.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vrint.ll?rev=330011&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/vrint.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/vrint.ll Fri Apr 13 05:45:12 2018
@@ -0,0 +1,11 @@
+; RUN: llc -mtriple=armv8 -mattr=+neon %s -o - | FileCheck %s
+
+declare float @llvm.arm.neon.vrintn.f32(float) nounwind readnone
+
+; CHECK-LABEL: vrintn_f32:
+; CHECK: vrintn.f32
+define float @vrintn_f32(float* %A) nounwind {
+ %tmp1 = load float, float* %A
+ %tmp2 = call float @llvm.arm.neon.vrintn.f32(float %tmp1)
+ ret float %tmp2
+}
More information about the llvm-commits
mailing list