[clang] [llvm] [OpenMP]Initial parsing/sema support for target_device selector set (PR #118471)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 08:05:38 PST 2024
================
@@ -15629,6 +15629,34 @@ ExprResult SemaOpenMP::VerifyPositiveIntegerConstantInClause(
return ICE;
}
+void SemaOpenMP::ActOnOpenMPDeviceNum(Expr *DeviceNumExpr) {
+ llvm::APSInt Result;
+ Expr::EvalResult EvalResult;
+ // Strip implicit casts from the expression
+ DeviceNumExpr = DeviceNumExpr->IgnoreImpCasts();
+ // Evaluate the expression to an integer value
+ if (DeviceNumExpr->EvaluateAsInt(EvalResult, SemaRef.Context)) {
+ // The device expression must evaluate to a non-negative integer value.
+ Result = EvalResult.Val.getInt();
+ if (Result.isNonNegative()) {
+ OMPContext::DeviceNum = Result.getSExtValue();
----------------
alexey-bataev wrote:
`Result.getZExtValue()], since it is non-negative?
https://github.com/llvm/llvm-project/pull/118471
More information about the llvm-commits
mailing list