[clang] [clang][bytecode] Handle UETT_OpenMPRequiredSimdAlign (PR #111259)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 5 08:47:21 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/111259.diff
2 Files Affected:
- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+7)
- (modified) clang/test/AST/ByteCode/builtins.cpp (+2)
``````````diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 680be736aa6471..e1326bba37269f 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -2128,6 +2128,13 @@ bool Compiler<Emitter>::VisitUnaryExprOrTypeTraitExpr(
return this->emitConst(1, E);
}
+ if (Kind == UETT_OpenMPRequiredSimdAlign) {
+ assert(E->isArgumentType());
+ unsigned Bits = ASTCtx.getOpenMPDefaultSimdAlign(E->getArgumentType());
+
+ return this->emitConst(ASTCtx.toCharUnitsFromBits(Bits).getQuantity(), E);
+ }
+
return false;
}
diff --git a/clang/test/AST/ByteCode/builtins.cpp b/clang/test/AST/ByteCode/builtins.cpp
index 9b2b20773be58a..324b8c741130c6 100644
--- a/clang/test/AST/ByteCode/builtins.cpp
+++ b/clang/test/AST/ByteCode/builtins.cpp
@@ -36,3 +36,5 @@ void test_builtin_os_log(void *buf, int i, const char *data) {
constexpr int len = __builtin_os_log_format_buffer_size("%d %{public}s %{private}.16P", i, data, data);
static_assert(len > 0, "Expect len > 0");
}
+
+static_assert(__builtin_omp_required_simd_align(int) != 0);
``````````
</details>
https://github.com/llvm/llvm-project/pull/111259
More information about the cfe-commits
mailing list