From c04449d09381b5bdc330eeeb03fbd586ed6e4c1f Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Tue, 10 Dec 2013 21:34:21 +0000 Subject: [PATCH] [AArch64] Refactor the NEON signed/unsigned floating-point convert to fixed-point LLVM AArch64 intrinsics to use f32/f64, rather than their vector equivalents. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196968 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGBuiltin.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index c54112192f..45b4b928ab 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -1762,12 +1762,13 @@ static Value *EmitAArch64ScalarBuiltinExpr(CodeGenFunction &CGF, 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 *EmitAArch64ScalarBuiltinExpr(CodeGenFunction &CGF, 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 *EmitAArch64ScalarBuiltinExpr(CodeGenFunction &CGF, } // 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) { -- 2.40.0