r196968 - [AArch64] Refactor the NEON signed/unsigned floating-point convert to fixed-point

Chad Rosier mcrosier at codeaurora.org
Tue Dec 10 13:34:22 PST 2013


Author: mcrosier
Date: Tue Dec 10 15:34:21 2013
New Revision: 196968

URL: http://llvm.org/viewvc/llvm-project?rev=196968&view=rev
Log:
[AArch64] Refactor the NEON signed/unsigned floating-point convert to fixed-point
LLVM AArch64 intrinsics to use f32/f64, rather than their vector equivalents.

Modified:
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=196968&r1=196967&r2=196968&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Dec 10 15:34:21 2013
@@ -1762,12 +1762,13 @@ static Value *EmitAArch64ScalarBuiltinEx
   enum {
     ScalarRet = (1 << 0),
     VectorRet = (1 << 1),
-    VectorGetArg0 = (1 << 2),
-    VectorCastArg0 = (1 << 3),
-    ScalarArg1 = (1 << 4),
-    VectorGetArg1 = (1 << 5),
-    VectorCastArg1 = (1 << 6),
-    VectorFpCmpzArg1 = (1 << 7)
+    ScalarArg0 = (1 << 2),
+    VectorGetArg0 = (1 << 3),
+    VectorCastArg0 = (1 << 4),
+    ScalarArg1 = (1 << 5),
+    VectorGetArg1 = (1 << 6),
+    VectorCastArg1 = (1 << 7),
+    VectorFpCmpzArg1 = (1 << 8)
   };
   const char *s = NULL;
 
@@ -2544,12 +2545,12 @@ static Value *EmitAArch64ScalarBuiltinEx
   case AArch64::BI__builtin_neon_vcvts_n_s32_f32:
   case AArch64::BI__builtin_neon_vcvtd_n_s64_f64:
     Int = Intrinsic::aarch64_neon_vcvtfp2fxs_n;
-    s = "fcvtzs"; IntTypes = VectorRet | VectorGetArg0; break;
+    s = "fcvtzs"; IntTypes = VectorRet | ScalarArg0; break;
   // Scalar Floating-point Convert To Unsigned Fixed-point (Immediate)
   case AArch64::BI__builtin_neon_vcvts_n_u32_f32:
   case AArch64::BI__builtin_neon_vcvtd_n_u64_f64:
     Int = Intrinsic::aarch64_neon_vcvtfp2fxu_n;
-    s = "fcvtzu"; IntTypes = VectorRet | VectorGetArg0; break;
+    s = "fcvtzu"; IntTypes = VectorRet | ScalarArg0; break;
   case AArch64::BI__builtin_neon_vmull_p64:
     Int = Intrinsic::aarch64_neon_vmull_p64;
     s = "vmull"; break;
@@ -2575,10 +2576,13 @@ static Value *EmitAArch64ScalarBuiltinEx
   }
 
   // Arguments.
-  if (IntTypes & (VectorGetArg0 | VectorCastArg0)) {
+  if (IntTypes & (ScalarArg0 | VectorGetArg0 | VectorCastArg0)) {
     const Expr *Arg = E->getArg(0);
-     llvm::Type *Ty = CGF.ConvertType(Arg->getType());
-    if (IntTypes & VectorGetArg0) {
+    llvm::Type *Ty = CGF.ConvertType(Arg->getType());
+    if (IntTypes & ScalarArg0) {
+      // Scalar argument.
+      Tys.push_back(Ty);
+    } else if (IntTypes & VectorGetArg0) {
       // Convert the scalar argument to one-vector element type.
       Tys.push_back(llvm::VectorType::get(Ty, 1));
     } else if (IntTypes & VectorCastArg0) {





More information about the cfe-commits mailing list