]> granicus.if.org Git - clang/commitdiff
[AArch64] Add support for NEON scalar fixed-point convert to floating-point instructions.
authorChad Rosier <mcrosier@codeaurora.org>
Thu, 31 Oct 2013 22:37:08 +0000 (22:37 +0000)
committerChad Rosier <mcrosier@codeaurora.org>
Thu, 31 Oct 2013 22:37:08 +0000 (22:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193817 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/arm_neon.td
lib/CodeGen/CGBuiltin.cpp
test/CodeGen/aarch64-neon-intrinsics.c

index 8f300647526736b9069ff2c9edca09111ec01f9e..96f9aa40efa792e1a091cd088b6625adc780e7b3 100644 (file)
@@ -820,6 +820,18 @@ def SCALAR_SQSHRUN_N: SInst<"vqshrun_n", "zsi", "SsSiSl">;
 def SCALAR_SQRSHRUN_N: SInst<"vqrshrun_n", "zsi", "SsSiSl">;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// Scalar Signed/Unsigned Fixed-point Convert To Floating-Point (Immediate)
+def SCALAR_SCVTF_N_F32: SInst<"vcvt_n_f32", "ysi", "SiSUi">;
+def SCALAR_SCVTF_N_F64: SInst<"vcvt_n_f64", "osi", "SlSUl">;
+
+////////////////////////////////////////////////////////////////////////////////
+// Scalar Floating-point Convert To Signed/Unsigned Fixed-point (Immediate)
+def SCALAR_FCVTZS_N_S32 : SInst<"vcvt_n_s32", "xsi", "Sf">;
+def SCALAR_FCVTZU_N_U32 : SInst<"vcvt_n_u32", "usi", "Sf">;
+def SCALAR_FCVTZS_N_S64 : SInst<"vcvt_n_s64", "xsi", "Sd">;
+def SCALAR_FCVTZU_N_U64 : SInst<"vcvt_n_u64", "usi", "Sd">;
+
 ////////////////////////////////////////////////////////////////////////////////
 // Scalar Reduce Pairwise Addition (Scalar and Floating Point)
 def SCALAR_ADDP  : SInst<"vpadd", "sd", "SfSHlSHd">;
index 1bed488858381c31e43b468e5e4ff3ffa0955467..8f724501d269f1c83642a0582dfc31df415d5d82 100644 (file)
@@ -2331,6 +2331,20 @@ static Value *EmitAArch64ScalarBuiltinExpr(CodeGenFunction &CGF,
   case AArch64::BI__builtin_neon_vqrshrund_n_s64:
     Int = Intrinsic::aarch64_neon_vsqrshrun;
     s = "vsqrshrun"; OverloadInt = true; break;
+  // Scalar Signed Fixed-point Convert To Floating-Point (Immediate)
+  case AArch64::BI__builtin_neon_vcvts_n_f32_s32:
+    Int = Intrinsic::aarch64_neon_vcvtf32_n_s32;
+    s = "vcvtf"; OverloadInt = false; break;
+  case AArch64::BI__builtin_neon_vcvtd_n_f64_s64:
+    Int = Intrinsic::aarch64_neon_vcvtf64_n_s64;
+    s = "vcvtf"; OverloadInt = false; break;
+  // Scalar Unsigned Fixed-point Convert To Floating-Point (Immediate)
+  case AArch64::BI__builtin_neon_vcvts_n_f32_u32:
+    Int = Intrinsic::aarch64_neon_vcvtf32_n_u32;
+    s = "vcvtf"; OverloadInt = false; break;
+  case AArch64::BI__builtin_neon_vcvtd_n_f64_u64:
+    Int = Intrinsic::aarch64_neon_vcvtf64_n_u64;
+    s = "vcvtf"; OverloadInt = false; break;
   }
 
   if (!Int)
index 159918fc25e0c5fbf4a87ef252774d124b9daa04..6cc6a69ad167ea9d69db2928f4e39a02d46f8dc1 100644 (file)
@@ -7747,3 +7747,27 @@ int32_t test_vqrshrund_n_s64(int64_t a) {
 // CHECK: sqrshrun {{s[0-9]+}}, {{d[0-9]+}}, #63
   return (int32_t)vqrshrund_n_s64(a, 63);
 }
+
+float32_t test_vcvts_n_f32_s32(int32_t a) {
+// CHECK: test_vcvts_n_f32_s32
+// CHECK: scvtf {{s[0-9]+}}, {{s[0-9]+}}, #0
+  return (float32_t)vcvts_n_f32_s32(a, 0);
+}
+
+float64_t test_vcvtd_n_f64_s64(int64_t a) {
+// CHECK: test_vcvtd_n_f64_s64
+// CHECK: scvtf {{d[0-9]+}}, {{d[0-9]+}}, #0
+  return (float64_t)vcvtd_n_f64_s64(a, 0);
+}
+
+float32_t test_vcvts_n_f32_u32(uint32_t a) {
+// CHECK: test_vcvts_n_f32_u32
+// CHECK: ucvtf {{s[0-9]+}}, {{s[0-9]+}}, #0
+  return (float32_t)vcvts_n_f32_u32(a, 0);
+}
+
+float64_t test_vcvtd_n_f64_u64(uint64_t a) {
+// CHECK: test_vcvtd_n_f64_u64
+// CHECK: ucvtf {{d[0-9]+}}, {{d[0-9]+}}, #0
+  return (float64_t)vcvtd_n_f64_u64(a, 0);
+}