[llvm] [clang] [AIX] support builtin_cpu_is() for aix (PR #80069)
zhijian lin via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 6 06:06:49 PST 2024
================
@@ -16542,22 +16542,75 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
Intrinsic::ID ID = Intrinsic::not_intrinsic;
+#include "llvm/TargetParser/PPCTargetParser.def"
+ auto GetOpRes = [&](Value *FieldValue, unsigned Mask, unsigned Op,
+ unsigned Op_Value) -> Value * {
+ Value *Value1 = FieldValue;
+ if (Mask)
+ Value1 = Builder.CreateAnd(Value1, Mask);
+ assert((Op == OP_EQ) && "Only support equal comparision");
+ return Builder.CreateICmp(ICmpInst::ICMP_EQ, FieldValue,
+ ConstantInt::get(Int32Ty, Op_Value));
+ };
+
+ auto ConvBuiltinCpu = [&](unsigned SupportOP, unsigned FieldIdx,
+ unsigned Op_Mask, unsigned Op,
+ unsigned Op_Value) -> Value * {
+ if (SupportOP == AIX_BUILTIN_PPC_FALSE)
+ return llvm::ConstantInt::getFalse(ConvertType(E->getType()));
----------------
diggerlin wrote:
I guess you want to let the code more efficiently with pulling out E->getType() ?
but
1. if I pull out E->getType() , it means that E->getType() will be run in the all call flow path even `SupportOP == OP_EQ`, which do not need the E->getType().
2. the `E->getType()` only be called once at maximum at each call flow path.
https://github.com/llvm/llvm-project/pull/80069
More information about the cfe-commits
mailing list