diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index a08e5452535c..cdcc36465b1d 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -1712,8 +1712,8 @@ CodeGenFunction::EmitPointerWithAlignment(const Expr *Addr) { } static Value *EmitAArch64ScalarBuiltinExpr(CodeGenFunction &CGF, - unsigned BuiltinID, - const CallExpr *E) { + unsigned BuiltinID, + const CallExpr *E) { NeonTypeFlags::EltType ET; bool usgn; unsigned int Int = 0; @@ -1745,54 +1745,54 @@ static Value *EmitAArch64ScalarBuiltinExpr(CodeGenFunction &CGF, s = "vsubdu"; usgn = true; OverloadInt = false; break; // Scalar Saturating Add case AArch64::BI__builtin_neon_vqaddb_s8: - ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqadds; - s = "vqadds"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqadds; + s = "vqadds"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqaddh_s16: - ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqadds; - s = "vqadds"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqadds; + s = "vqadds"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqadds_s32: - ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqadds; - s = "vqadds"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqadds; + s = "vqadds"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqaddd_s64: - ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqadds; - s = "vqadds"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqadds; + s = "vqadds"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqaddb_u8: - ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqaddu; - s = "vqaddu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqaddu; + s = "vqaddu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqaddh_u16: - ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqaddu; - s = "vqaddu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqaddu; + s = "vqaddu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqadds_u32: - ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqaddu; - s = "vqaddu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqaddu; + s = "vqaddu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqaddd_u64: - ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqaddu; - s = "vqaddu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqaddu; + s = "vqaddu"; usgn = true; OverloadInt = true; break; // Scalar Saturating Sub case AArch64::BI__builtin_neon_vqsubb_s8: - ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqsubs; - s = "vqsubs"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqsubs; + s = "vqsubs"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqsubh_s16: - ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqsubs; - s = "vqsubs"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqsubs; + s = "vqsubs"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqsubs_s32: - ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqsubs; - s = "vqsubs"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqsubs; + s = "vqsubs"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqsubd_s64: - ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqsubs; - s = "vqsubs"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqsubs; + s = "vqsubs"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqsubb_u8: - ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqsubu; - s = "vqsubu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqsubu; + s = "vqsubu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqsubh_u16: - ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqsubu; - s = "vqsubu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqsubu; + s = "vqsubu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqsubs_u32: - ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqsubu; - s = "vqsubu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqsubu; + s = "vqsubu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqsubd_u64: - ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqsubu; - s = "vqsubu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqsubu; + s = "vqsubu"; usgn = true; OverloadInt = true; break; // Scalar Shift Left case AArch64::BI__builtin_neon_vshld_s64: ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vshlds; @@ -1802,29 +1802,29 @@ static Value *EmitAArch64ScalarBuiltinExpr(CodeGenFunction &CGF, s = "vshldu"; usgn = true; OverloadInt = false; break; // Scalar Saturating Shift Left case AArch64::BI__builtin_neon_vqshlb_s8: - ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqshls; - s = "vqshls"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqshls; + s = "vqshls"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqshlh_s16: - ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqshls; - s = "vqshls"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqshls; + s = "vqshls"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqshls_s32: - ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqshls; - s = "vqshls"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqshls; + s = "vqshls"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqshld_s64: - ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqshls; - s = "vqshls"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqshls; + s = "vqshls"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqshlb_u8: - ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqshlu; - s = "vqshlu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqshlu; + s = "vqshlu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqshlh_u16: - ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqshlu; - s = "vqshlu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqshlu; + s = "vqshlu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqshls_u32: - ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqshlu; - s = "vqshlu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqshlu; + s = "vqshlu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqshld_u64: - ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqshlu; - s = "vqshlu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqshlu; + s = "vqshlu"; usgn = true; OverloadInt = true; break; // Scalar Rouding Shift Left case AArch64::BI__builtin_neon_vrshld_s64: ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vrshlds; @@ -1834,67 +1834,67 @@ static Value *EmitAArch64ScalarBuiltinExpr(CodeGenFunction &CGF, s = "vrshldu"; usgn = true; OverloadInt=false; break; // Scalar Saturating Rouding Shift Left case AArch64::BI__builtin_neon_vqrshlb_s8: - ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqrshls; - s = "vqrshls"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqrshls; + s = "vqrshls"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqrshlh_s16: - ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqrshls; - s = "vqrshls"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqrshls; + s = "vqrshls"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqrshls_s32: - ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqrshls; - s = "vqrshls"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqrshls; + s = "vqrshls"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqrshld_s64: - ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqrshls; - s = "vqrshls"; usgn = false; OverloadInt = true; break; + ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqrshls; + s = "vqrshls"; usgn = false; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqrshlb_u8: - ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqrshlu; - s = "vqrshlu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int8; Int = Intrinsic::aarch64_neon_vqrshlu; + s = "vqrshlu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqrshlh_u16: - ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqrshlu; - s = "vqrshlu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int16; Int = Intrinsic::aarch64_neon_vqrshlu; + s = "vqrshlu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqrshls_u32: - ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqrshlu; - s = "vqrshlu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int32; Int = Intrinsic::aarch64_neon_vqrshlu; + s = "vqrshlu"; usgn = true; OverloadInt = true; break; case AArch64::BI__builtin_neon_vqrshld_u64: - ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqrshlu; - s = "vqrshlu"; usgn = true; OverloadInt = true; break; + ET = NeonTypeFlags::Int64; Int = Intrinsic::aarch64_neon_vqrshlu; + s = "vqrshlu"; usgn = true; OverloadInt = true; break; // Scalar Reduce Pairwise Add case AArch64::BI__builtin_neon_vpaddd_s64: Int = Intrinsic::aarch64_neon_vpadd; s = "vpadd"; - OverloadInt = false; break; + OverloadInt = false; break; case AArch64::BI__builtin_neon_vpadds_f32: Int = Intrinsic::aarch64_neon_vpfadd; s = "vpfadd"; - OverloadInt = false; break; + OverloadInt = false; break; case AArch64::BI__builtin_neon_vpaddd_f64: Int = Intrinsic::aarch64_neon_vpfaddq; s = "vpfaddq"; - OverloadInt = false; break; + OverloadInt = false; break; // Scalar Reduce Pairwise Floating Point Max case AArch64::BI__builtin_neon_vpmaxs_f32: Int = Intrinsic::aarch64_neon_vpmax; s = "vpmax"; - OverloadInt = false; break; + OverloadInt = false; break; case AArch64::BI__builtin_neon_vpmaxqd_f64: Int = Intrinsic::aarch64_neon_vpmaxq; s = "vpmaxq"; - OverloadInt = false; break; + OverloadInt = false; break; // Scalar Reduce Pairwise Floating Point Min case AArch64::BI__builtin_neon_vpmins_f32: - Int = Intrinsic::aarch64_neon_vpmin; s = "vpmin"; - OverloadInt = false; break; + Int = Intrinsic::aarch64_neon_vpmin; s = "vpmin"; + OverloadInt = false; break; case AArch64::BI__builtin_neon_vpminqd_f64: - Int = Intrinsic::aarch64_neon_vpminq; s = "vpminq"; - OverloadInt = false; break; + Int = Intrinsic::aarch64_neon_vpminq; s = "vpminq"; + OverloadInt = false; break; // Scalar Reduce Pairwise Floating Point Maxnm case AArch64::BI__builtin_neon_vpmaxnms_f32: - Int = Intrinsic::aarch64_neon_vpfmaxnm; s = "vpfmaxnm"; - OverloadInt = false; break; + Int = Intrinsic::aarch64_neon_vpfmaxnm; s = "vpfmaxnm"; + OverloadInt = false; break; case AArch64::BI__builtin_neon_vpmaxnmqd_f64: - Int = Intrinsic::aarch64_neon_vpfmaxnmq; s = "vpfmaxnmq"; - OverloadInt = false; break; + Int = Intrinsic::aarch64_neon_vpfmaxnmq; s = "vpfmaxnmq"; + OverloadInt = false; break; // Scalar Reduce Pairwise Floating Point Minnm case AArch64::BI__builtin_neon_vpminnms_f32: - Int = Intrinsic::aarch64_neon_vpfminnm; s = "vpfminnm"; - OverloadInt = false; break; + Int = Intrinsic::aarch64_neon_vpfminnm; s = "vpfminnm"; + OverloadInt = false; break; case AArch64::BI__builtin_neon_vpminnmqd_f64: - Int = Intrinsic::aarch64_neon_vpfminnmq; s = "vpfminnmq"; - OverloadInt = false; break; + Int = Intrinsic::aarch64_neon_vpfminnmq; s = "vpfminnmq"; + OverloadInt = false; break; } if (!Int) @@ -1907,15 +1907,15 @@ static Value *EmitAArch64ScalarBuiltinExpr(CodeGenFunction &CGF, llvm::Type *Ty = 0; Function *F = 0; if (OverloadInt) { - // Determine the type of this overloaded AArch64 intrinsic - NeonTypeFlags Type(ET, usgn, false); - llvm::VectorType *VTy = GetNeonType(&CGF, Type, true); - Ty = VTy; - if (!Ty) - return 0; - F = CGF.CGM.getIntrinsic(Int, Ty); + // Determine the type of this overloaded AArch64 intrinsic + NeonTypeFlags Type(ET, usgn, false); + llvm::VectorType *VTy = GetNeonType(&CGF, Type, true); + Ty = VTy; + if (!Ty) + return 0; + F = CGF.CGM.getIntrinsic(Int, Ty); } else - F = CGF.CGM.getIntrinsic(Int); + F = CGF.CGM.getIntrinsic(Int); Value *Result = CGF.EmitNeonCall(F, Ops, s); llvm::Type *ResultType = CGF.ConvertType(E->getType());