]> granicus.if.org Git - clang/commitdiff
[AArch64] Add support for NEON scalar signed/unsigned integer to floating-point
authorChad Rosier <mcrosier@codeaurora.org>
Tue, 8 Oct 2013 20:43:46 +0000 (20:43 +0000)
committerChad Rosier <mcrosier@codeaurora.org>
Tue, 8 Oct 2013 20:43:46 +0000 (20:43 +0000)
convert instructions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192232 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 3482b8f77f5616eb352aa2af747fe02267fc56c5..6228bdc043d01e46b4f2c930e78dfa5de4ae7517 100644 (file)
@@ -167,6 +167,8 @@ class NoTestOpInst<string n, string p, string t, Op o> : Inst<n, p, t, o> {}
 // s: scalar of element type
 // r: scalar of double width element type
 // a: scalar of element type (splat to vector type)
+// y: scalar of float
+// o: scalar of double
 // k: default elt width, double num elts
 // #: array of default vectors
 // p: pointer type
@@ -765,4 +767,14 @@ def SCALAR_FRECPS : IInst<"vrecps", "sss", "SfSd">;
 // Scalar Floating-point Reciprocal Square Root Step
 def SCALAR_FRSQRTS : IInst<"vrsqrts", "sss", "SfSd">;
 
+////////////////////////////////////////////////////////////////////////////////
+// Scalar Signed Integer Convert To Floating-point
+def SCALAR_SCVTFS : SInst<"vcvt_f32", "ys", "Si">;
+def SCALAR_SCVTFD : SInst<"vcvt_f64", "os", "Sl">;
+
+////////////////////////////////////////////////////////////////////////////////
+// Scalar Unsigned Integer Convert To Floating-point
+def SCALAR_UCVTFS : SInst<"vcvt_f32", "ys", "SUi">;
+def SCALAR_UCVTFD : SInst<"vcvt_f64", "os", "SUl">;
+
 }
index 093ab9b11d2829a63739f6acbe7be4fc0828271b..a2b0bbc282956a617de897672bf08fd30c7a30bf 100644 (file)
@@ -1971,6 +1971,20 @@ static Value *EmitAArch64ScalarBuiltinExpr(CodeGenFunction &CGF,
   case AArch64::BI__builtin_neon_vrsqrtsd_f64:
     Int = Intrinsic::arm_neon_vrsqrts;
     s = "vrsqrts"; OverloadInt = true; break;
+  // Scalar Signed Integer Convert To Floating-point
+  case AArch64::BI__builtin_neon_vcvts_f32_s32:
+    Int = Intrinsic::aarch64_neon_vcvtf32_s32,
+    s = "vcvtf"; OverloadInt = false; break;
+  case AArch64::BI__builtin_neon_vcvtd_f64_s64:
+    Int = Intrinsic::aarch64_neon_vcvtf64_s64,
+    s = "vcvtf"; OverloadInt = false; break;
+  // Scalar Unsigned Integer Convert To Floating-point
+  case AArch64::BI__builtin_neon_vcvts_f32_u32:
+    Int = Intrinsic::aarch64_neon_vcvtf32_u32,
+    s = "vcvtf"; OverloadInt = false; break;
+  case AArch64::BI__builtin_neon_vcvtd_f64_u64:
+    Int = Intrinsic::aarch64_neon_vcvtf64_u64,
+    s = "vcvtf"; OverloadInt = false; break;
   }
 
   if (!Int)
index 07b15b55f6ea29742f53fcf6ea07ae2799b6d641..d672f096001b4a5544296ec6c26fa8a5ae90950d 100644 (file)
@@ -5597,3 +5597,27 @@ float64_t test_vrsqrtsd_f64(float64_t a, float64_t b) {
   return vrsqrtsd_f64(a, b);
 // CHECK: frsqrts {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
 }
+
+float32_t test_vcvts_f32_s32(int32_t a) {
+// CHECK: test_vcvts_f32_s32
+// CHECK: scvtf {{s[0-9]+}}, {{s[0-9]+}}
+  return (float32_t)vcvts_f32_s32(a);
+}
+
+float64_t test_vcvtd_f64_s64(int64_t a) {
+// CHECK: test_vcvtd_f64_s64
+// CHECK: scvtf {{d[0-9]+}}, {{d[0-9]+}}
+  return (float64_t)vcvtd_f64_s64(a);
+}
+
+float32_t test_vcvts_f32_u32(uint32_t a) {
+// CHECK: test_vcvts_f32_u32
+// CHECK: ucvtf {{s[0-9]+}}, {{s[0-9]+}}
+  return (float32_t)vcvts_f32_u32(a);
+}
+
+float64_t test_vcvtd_f64_u64(uint64_t a) {
+// CHECK: test_vcvtd_f64_u64
+// CHECK: ucvtf {{d[0-9]+}}, {{d[0-9]+}}
+  return (float64_t)vcvtd_f64_u64(a);
+}
index 78075ba8a008ae393079d4e6f70e7112e00a0fa5..21827da2a369792546ed30e285e4897bc92420b3 100644 (file)
@@ -456,6 +456,13 @@ static char ModType(const char mod, char type, bool &quad, bool &poly,
       if (type == 'd')
         type = 'l';
       break;
+    case 'o':
+      scal = true;
+      type = 'd';
+      usgn = false;
+      break;
+    case 'y':
+      scal = true;
     case 'f':
       if (type == 'h')
         quad = true;