llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clangir Author: None (adams381) <details> <summary>Changes</summary> This PR adds support for various math and builtin intrinsics to CIR: ## Changes 1. **Floating-point math intrinsics** - sqrt, cos, exp, exp2, floor, fabs, sin, log, log2, log10, ceil, nearbyint, rint, round, trunc, copysign, fma, fmax, fmin, pow 2. **Inverse trig, atan2, and roundeven** - acos, asin, atan, atan2, roundeven 3. **Elementwise builtins** - add_sat, sub_sat, abs, max, min, bitreverse, popcount, canonicalize 4. **Integer abs family** - abs, labs, llabs and their __builtin_ variants 5. **Prediction builtins** - __builtin_unpredictable 6. **Tests for rotate builtins** - Added OGCG checks for __builtin_rotateleft/right All changes include CIR, LLVM lowering, and OGCG test checks to verify correctness. --- Patch is 134.99 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/175233.diff 12 Files Affected: - (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+180) - (modified) clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp (+152-15) - (modified) clang/lib/CIR/CodeGen/CIRGenExpr.cpp (+1-2) - (modified) clang/lib/CIR/CodeGen/CIRGenModule.cpp (+38) - (modified) clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp (+201) - (added) clang/test/CIR/CodeGen/builtin-floating-point.c (+1746) - (added) clang/test/CIR/CodeGen/builtin-rotate.c (+119) - (added) clang/test/CIR/CodeGen/builtins-elementwise.c (+515) - (modified) clang/test/CIR/CodeGen/libc.c (+24-8) - (added) clang/test/CIR/CodeGen/pred-info-builtins.c (+72) - (modified) clang/test/CIR/CodeGenBuiltins/builtin-fcmp-sse.c (+12-12) - (modified) clang/test/CIR/CodeGenBuiltins/builtin-isfpclass.c (+2-2) ``````````diff diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index 8358b076ee7b6..5ac64585f000f 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -5096,6 +5096,106 @@ def CIR_Exp2Op : CIR_UnaryFPToFPBuiltinOp<"exp2", "Exp2Op"> { }]; } +def CIR_LogOp : CIR_UnaryFPToFPBuiltinOp<"log", "LogOp"> { + let summary = "Computes the floating-point natural logarithm"; + let description = [{ + `cir.log` computes the natural logarithm of a floating-point operand and + returns a result of the same type. + + Floating-point exceptions are ignored, and it does not set `errno`. + }]; +} + +def CIR_Log10Op : CIR_UnaryFPToFPBuiltinOp<"log10", "Log10Op"> { + let summary = "Computes the floating-point base-10 logarithm"; + let description = [{ + `cir.log10` computes the base-10 logarithm of a floating-point operand and + returns a result of the same type. + + Floating-point exceptions are ignored, and it does not set `errno`. + }]; +} + +def CIR_Log2Op : CIR_UnaryFPToFPBuiltinOp<"log2", "Log2Op"> { + let summary = "Computes the floating-point base-2 logarithm"; + let description = [{ + `cir.log2` computes the base-2 logarithm of a floating-point operand and + returns a result of the same type. + + Floating-point exceptions are ignored, and it does not set `errno`. + }]; +} + +def CIR_NearbyintOp : CIR_UnaryFPToFPBuiltinOp<"nearbyint", "NearbyintOp"> { + let summary = "Rounds floating-point value to nearest integer"; + let description = [{ + `cir.nearbyint` rounds a floating-point operand to the nearest integer value + and returns a result of the same type. + + Floating-point exceptions are ignored, and it does not set `errno`. + }]; +} + +def CIR_RintOp : CIR_UnaryFPToFPBuiltinOp<"rint", "RintOp"> { + let summary = "Rounds floating-point value to nearest integer"; + let description = [{ + `cir.rint` rounds a floating-point operand to the nearest integer value + and returns a result of the same type. + + Floating-point exceptions are ignored, and it does not set `errno`. + }]; +} + +def CIR_RoundOp : CIR_UnaryFPToFPBuiltinOp<"round", "RoundOp"> { + let summary = "Rounds floating-point value to nearest integer"; + let description = [{ + `cir.round` rounds a floating-point operand to the nearest integer value + and returns a result of the same type. + + Floating-point exceptions are ignored, and it does not set `errno`. + }]; +} + +def CIR_RoundEvenOp : CIR_UnaryFPToFPBuiltinOp<"roundeven", "RoundEvenOp"> { + let summary = "Rounds floating-point value to nearest integer, ties to even"; + let description = [{ + `cir.roundeven` rounds a floating-point operand to the nearest integer + value, with ties rounding to even (banker's rounding). + + Floating-point exceptions are ignored, and it does not set `errno`. + }]; +} + +def CIR_SinOp : CIR_UnaryFPToFPBuiltinOp<"sin", "SinOp"> { + let summary = "Computes the floating-point sine"; + let description = [{ + `cir.sin` computes the sine of a floating-point operand and returns + a result of the same type. + + Floating-point exceptions are ignored, and it does not set `errno`. + }]; +} + +def CIR_TanOp : CIR_UnaryFPToFPBuiltinOp<"tan", "TanOp"> { + let summary = "Computes the floating-point tangent"; + let description = [{ + `cir.tan` computes the tangent of a floating-point operand and returns + a result of the same type. + + Floating-point exceptions are ignored, and it does not set `errno`. + }]; +} + +def CIR_TruncOp : CIR_UnaryFPToFPBuiltinOp<"trunc", "TruncOp"> { + let summary = "Truncates floating-point value to integer"; + let description = [{ + `cir.trunc` truncates a floating-point operand to an integer value + and returns a result of the same type. + + Floating-point exceptions are ignored, and it does not set `errno`. + }]; +} + def CIR_FAbsOp : CIR_UnaryFPToFPBuiltinOp<"fabs", "FAbsOp"> { let summary = "Computes the floating-point absolute value"; let description = [{ @@ -5106,6 +5206,34 @@ def CIR_FAbsOp : CIR_UnaryFPToFPBuiltinOp<"fabs", "FAbsOp"> { }]; } +def CIR_AbsOp : CIR_Op<"abs", [Pure, SameOperandsAndResultType]> { + let summary = "Computes the absolute value of a signed integer"; + let description = [{ + `cir.abs` computes the absolute value of a signed integer or vector + of signed integers. + + The `poison` attribute indicates whether the result value is a poison + value if the argument is statically or dynamically INT_MIN. + + Example: + + ```mlir + %0 = cir.const #cir.int<-42> : s32i + %1 = cir.abs %0 poison : s32i + %2 = cir.abs %3 : !cir.vector<!s32i x 4> + ``` + }]; + + let arguments = (ins + CIR_AnySIntOrVecOfSIntType:$src, + UnitAttr:$poison + ); + + let results = (outs CIR_AnySIntOrVecOfSIntType:$result); + + let assemblyFormat = "$src ( `poison` $poison^ )? `:` type($src) attr-dict"; +} + def CIR_FloorOp : CIR_UnaryFPToFPBuiltinOp<"floor", "FloorOp"> { let summary = "Computes the floating-point floor value"; let description = [{ @@ -5123,6 +5251,58 @@ def CIR_FloorOp : CIR_UnaryFPToFPBuiltinOp<"floor", "FloorOp"> { }]; } +class CIR_UnaryFPToIntBuiltinOp<string mnemonic, string llvmOpName> + : CIR_Op<mnemonic, [Pure]> +{ + let arguments = (ins CIR_AnyFloatType:$src); + let results = (outs CIR_IntType:$result); + + let summary = [{ + Builtin function that takes a floating-point value as input and produces an + integral value as output. + }]; + + let assemblyFormat = [{ + $src `:` type($src) `->` type($result) attr-dict + }]; + + let llvmOp = llvmOpName; +} + +def CIR_LroundOp : CIR_UnaryFPToIntBuiltinOp<"lround", "LroundOp">; +def CIR_LLroundOp : CIR_UnaryFPToIntBuiltinOp<"llround", "LlroundOp">; +def CIR_LrintOp : CIR_UnaryFPToIntBuiltinOp<"lrint", "LrintOp">; +def CIR_LLrintOp : CIR_UnaryFPToIntBuiltinOp<"llrint", "LlrintOp">; + +class CIR_BinaryFPToFPBuiltinOp<string mnemonic, string llvmOpName> + : CIR_Op<mnemonic, [Pure, SameOperandsAndResultType]> { + let summary = [{ + libc builtin equivalent ignoring floating-point exceptions and errno. + }]; + + let arguments = (ins + CIR_AnyFloatOrVecOfFloatType:$lhs, + CIR_AnyFloatOrVecOfFloatType:$rhs + ); + + let results = (outs CIR_AnyFloatOrVecOfFloatType:$result); + + let assemblyFormat = [{ + $lhs `,` $rhs `:` qualified(type($lhs)) attr-dict + }]; + + let llvmOp = llvmOpName; +} + +def CIR_CopysignOp : CIR_BinaryFPToFPBuiltinOp<"copysign", "CopySignOp">; +def CIR_FMaxNumOp : CIR_BinaryFPToFPBuiltinOp<"fmaxnum", "MaxNumOp">; +def CIR_FMaximumOp : CIR_BinaryFPToFPBuiltinOp<"fmaximum", "MaximumOp">; +def CIR_FMinNumOp : CIR_BinaryFPToFPBuiltinOp<"fminnum", "MinNumOp">; +def CIR_FMinimumOp : CIR_BinaryFPToFPBuiltinOp<"fminimum", "MinimumOp">; +def CIR_FModOp : CIR_BinaryFPToFPBuiltinOp<"fmod", "FRemOp">; +def CIR_PowOp : CIR_BinaryFPToFPBuiltinOp<"pow", "PowOp">; +def CIR_ATan2Op : CIR_BinaryFPToFPBuiltinOp<"atan2", "ATan2Op">; + //===----------------------------------------------------------------------===// // Variadic Operations //===----------------------------------------------------------------------===// diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp index 85406e9f6488a..0f30de30bf405 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp @@ -150,6 +150,45 @@ static RValue emitUnaryFPBuiltin(CIRGenFunction &cgf, const CallExpr &e) { return RValue::get(call->getResult(0)); } +template <typename Op> +static RValue emitUnaryMaybeConstrainedFPToIntBuiltin(CIRGenFunction &cgf, + const CallExpr &e) { + mlir::Type resultType = cgf.convertType(e.getType()); + mlir::Value src = cgf.emitScalarExpr(e.getArg(0)); + + assert(!cir::MissingFeatures::fpConstraints()); + + auto call = Op::create(cgf.getBuilder(), src.getLoc(), resultType, src); + return RValue::get(call->getResult(0)); +} + +template <typename Op> +static RValue emitBinaryFPBuiltin(CIRGenFunction &cgf, const CallExpr &e) { + mlir::Value arg0 = cgf.emitScalarExpr(e.getArg(0)); + mlir::Value arg1 = cgf.emitScalarExpr(e.getArg(1)); + + mlir::Location loc = cgf.getLoc(e.getExprLoc()); + mlir::Type ty = cgf.convertType(e.getType()); + auto call = Op::create(cgf.getBuilder(), loc, ty, arg0, arg1); + + return RValue::get(call->getResult(0)); +} + +template <typename Op> +static mlir::Value emitBinaryMaybeConstrainedFPBuiltin(CIRGenFunction &cgf, + const CallExpr &e) { + mlir::Value arg0 = cgf.emitScalarExpr(e.getArg(0)); + mlir::Value arg1 = cgf.emitScalarExpr(e.getArg(1)); + + mlir::Location loc = cgf.getLoc(e.getExprLoc()); + mlir::Type ty = cgf.convertType(e.getType()); + + assert(!cir::MissingFeatures::fpConstraints()); + + auto call = Op::create(cgf.getBuilder(), loc, ty, arg0, arg1); + return call->getResult(0); +} + static RValue errorBuiltinNYI(CIRGenFunction &cgf, const CallExpr *e, unsigned builtinID) { @@ -263,6 +302,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_acosl: case Builtin::BI__builtin_acosf128: case Builtin::BI__builtin_elementwise_acos: + return emitUnaryMaybeConstrainedFPBuiltin<cir::ACosOp>(cgf, *e); case Builtin::BIasin: case Builtin::BIasinf: case Builtin::BIasinl: @@ -272,6 +312,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_asinl: case Builtin::BI__builtin_asinf128: case Builtin::BI__builtin_elementwise_asin: + return emitUnaryMaybeConstrainedFPBuiltin<cir::ASinOp>(cgf, *e); case Builtin::BIatan: case Builtin::BIatanf: case Builtin::BIatanl: @@ -281,6 +322,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_atanl: case Builtin::BI__builtin_atanf128: case Builtin::BI__builtin_elementwise_atan: + return emitUnaryMaybeConstrainedFPBuiltin<cir::ATanOp>(cgf, *e); case Builtin::BIatan2: case Builtin::BIatan2f: case Builtin::BIatan2l: @@ -290,7 +332,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_atan2l: case Builtin::BI__builtin_atan2f128: case Builtin::BI__builtin_elementwise_atan2: - return RValue::getIgnored(); + return emitBinaryFPBuiltin<cir::ATan2Op>(cgf, *e); case Builtin::BIceil: case Builtin::BIceilf: case Builtin::BIceill: @@ -301,6 +343,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_ceilf128: return emitUnaryMaybeConstrainedFPBuiltin<cir::CeilOp>(cgf, *e); case Builtin::BI__builtin_elementwise_ceil: + return RValue::getIgnored(); case Builtin::BIcopysign: case Builtin::BIcopysignf: case Builtin::BIcopysignl: @@ -309,7 +352,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_copysignf16: case Builtin::BI__builtin_copysignl: case Builtin::BI__builtin_copysignf128: - return RValue::getIgnored(); + return emitBinaryFPBuiltin<cir::CopysignOp>(cgf, *e); case Builtin::BIcos: case Builtin::BIcosf: case Builtin::BIcosl: @@ -386,6 +429,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_fmal: case Builtin::BI__builtin_fmaf128: case Builtin::BI__builtin_elementwise_fma: + return RValue::getIgnored(); case Builtin::BIfmax: case Builtin::BIfmaxf: case Builtin::BIfmaxl: @@ -394,6 +438,8 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_fmaxf16: case Builtin::BI__builtin_fmaxl: case Builtin::BI__builtin_fmaxf128: + return RValue::get( + emitBinaryMaybeConstrainedFPBuiltin<cir::FMaxNumOp>(cgf, *e)); case Builtin::BIfmin: case Builtin::BIfminf: case Builtin::BIfminl: @@ -402,6 +448,8 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_fminf16: case Builtin::BI__builtin_fminl: case Builtin::BI__builtin_fminf128: + return RValue::get( + emitBinaryMaybeConstrainedFPBuiltin<cir::FMinNumOp>(cgf, *e)); case Builtin::BIfmaximum_num: case Builtin::BIfmaximum_numf: case Builtin::BIfmaximum_numl: @@ -418,6 +466,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_fminimum_numf16: case Builtin::BI__builtin_fminimum_numl: case Builtin::BI__builtin_fminimum_numf128: + return RValue::getIgnored(); case Builtin::BIfmod: case Builtin::BIfmodf: case Builtin::BIfmodl: @@ -426,7 +475,9 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_fmodf16: case Builtin::BI__builtin_fmodl: case Builtin::BI__builtin_fmodf128: + return emitBinaryFPBuiltin<cir::FModOp>(cgf, *e); case Builtin::BI__builtin_elementwise_fmod: + return RValue::getIgnored(); case Builtin::BIlog: case Builtin::BIlogf: case Builtin::BIlogl: @@ -436,6 +487,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_logl: case Builtin::BI__builtin_logf128: case Builtin::BI__builtin_elementwise_log: + return emitUnaryMaybeConstrainedFPBuiltin<cir::LogOp>(cgf, *e); case Builtin::BIlog10: case Builtin::BIlog10f: case Builtin::BIlog10l: @@ -445,6 +497,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_log10l: case Builtin::BI__builtin_log10f128: case Builtin::BI__builtin_elementwise_log10: + return emitUnaryMaybeConstrainedFPBuiltin<cir::Log10Op>(cgf, *e); case Builtin::BIlog2: case Builtin::BIlog2f: case Builtin::BIlog2l: @@ -454,6 +507,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_log2l: case Builtin::BI__builtin_log2f128: case Builtin::BI__builtin_elementwise_log2: + return emitUnaryMaybeConstrainedFPBuiltin<cir::Log2Op>(cgf, *e); case Builtin::BInearbyint: case Builtin::BInearbyintf: case Builtin::BInearbyintl: @@ -462,6 +516,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_nearbyintl: case Builtin::BI__builtin_nearbyintf128: case Builtin::BI__builtin_elementwise_nearbyint: + return emitUnaryMaybeConstrainedFPBuiltin<cir::NearbyintOp>(cgf, *e); case Builtin::BIpow: case Builtin::BIpowf: case Builtin::BIpowl: @@ -470,7 +525,10 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_powf16: case Builtin::BI__builtin_powl: case Builtin::BI__builtin_powf128: + return RValue::get( + emitBinaryMaybeConstrainedFPBuiltin<cir::PowOp>(cgf, *e)); case Builtin::BI__builtin_elementwise_pow: + return RValue::getIgnored(); case Builtin::BIrint: case Builtin::BIrintf: case Builtin::BIrintl: @@ -480,6 +538,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_rintl: case Builtin::BI__builtin_rintf128: case Builtin::BI__builtin_elementwise_rint: + return emitUnaryMaybeConstrainedFPBuiltin<cir::RintOp>(cgf, *e); case Builtin::BIround: case Builtin::BIroundf: case Builtin::BIroundl: @@ -489,6 +548,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_roundl: case Builtin::BI__builtin_roundf128: case Builtin::BI__builtin_elementwise_round: + return emitUnaryMaybeConstrainedFPBuiltin<cir::RoundOp>(cgf, *e); case Builtin::BIroundeven: case Builtin::BIroundevenf: case Builtin::BIroundevenl: @@ -498,6 +558,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_roundevenl: case Builtin::BI__builtin_roundevenf128: case Builtin::BI__builtin_elementwise_roundeven: + return emitUnaryMaybeConstrainedFPBuiltin<cir::RoundEvenOp>(cgf, *e); case Builtin::BIsin: case Builtin::BIsinf: case Builtin::BIsinl: @@ -507,6 +568,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_sinl: case Builtin::BI__builtin_sinf128: case Builtin::BI__builtin_elementwise_sin: + return emitUnaryMaybeConstrainedFPBuiltin<cir::SinOp>(cgf, *e); case Builtin::BIsinh: case Builtin::BIsinhf: case Builtin::BIsinhl: @@ -527,6 +589,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_sincosf16: case Builtin::BI__builtin_sincosl: case Builtin::BI__builtin_sincosf128: + return RValue::getIgnored(); case Builtin::BIsqrt: case Builtin::BIsqrtf: case Builtin::BIsqrtl: @@ -536,6 +599,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_sqrtl: case Builtin::BI__builtin_sqrtf128: case Builtin::BI__builtin_elementwise_sqrt: + return emitUnaryMaybeConstrainedFPBuiltin<cir::SqrtOp>(cgf, *e); case Builtin::BItan: case Builtin::BItanf: case Builtin::BItanl: @@ -545,6 +609,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_tanl: case Builtin::BI__builtin_tanf128: case Builtin::BI__builtin_elementwise_tan: + return emitUnaryMaybeConstrainedFPBuiltin<cir::TanOp>(cgf, *e); case Builtin::BItanh: case Builtin::BItanhf: case Builtin::BItanhl: @@ -554,6 +619,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_tanhl: case Builtin::BI__builtin_tanhf128: case Builtin::BI__builtin_elementwise_tanh: + return RValue::getIgnored(); case Builtin::BItrunc: case Builtin::BItruncf: case Builtin::BItruncl: @@ -563,6 +629,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_truncl: case Builtin::BI__builtin_truncf128: case Builtin::BI__builtin_elementwise_trunc: + return emitUnaryMaybeConstrainedFPBuiltin<cir::TruncOp>(cgf, *e); case Builtin::BIlround: case Builtin::BIlroundf: case Builtin::BIlroundl: @@ -570,6 +637,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_lroundf: case Builtin::BI__builtin_lroundl: case Builtin::BI__builtin_lroundf128: + return emitUnaryMaybeConstrainedFPToIntBuiltin<cir::LroundOp>(cgf, *e); case Builtin::BIllround: case Builtin::BIllroundf: case Builtin::BIllroundl: @@ -577,6 +645,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_llroundf: case Builtin::BI__builtin_llroundl: case Builtin::BI__builtin_llroundf128: + return emitUnaryMaybeConstrainedFPToIntBuiltin<cir::LLroundOp>(cgf, *e); case Builtin::BIlrint: case Builtin::BIlrintf: case Builtin::BIlrintl: @@ -584,6 +653,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_lrintf: case Builtin::BI__builtin_lrintl: case Builtin::BI__builtin_lrintf128: + return emitUnaryMaybeConstrainedFPToIntBuiltin<cir::LrintOp>(cgf, *e); case Builtin::BIllrint: case Builtin::BIllrintf: case Builtin::BIllrintl: @@ -591,6 +661,7 @@ static RValue tryEmitFPMathIntrinsic(CIRGenFunction &cgf, const CallExpr *e, case Builtin::BI__builtin_llrintf: case Builtin::BI__builtin_llrintl: case Builtin::BI__builtin_llrintf128: + return emitUnaryMaybeConstrainedFPToIntBuiltin<cir::LLrintOp>(cgf, *e); case Builtin::BI__builtin_ldexp: case Builtin::BI__builtin_ldexpf: case Builtin::BI__builtin_ldexpl: @@ -677,6 +748,36 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID, cir::VACopyOp::create(builder, dstPtr.getLoc(), dstPtr, srcPtr); return {}; } + + case Builtin::BIabs: + case Builtin::BIlabs: + case Builtin::BIllabs: + case Builtin::BI__builtin_abs: + case Builtin::BI__builtin_labs: + case Builtin::BI__builtin_ll... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/175233 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
