[clang] [clang][bytecode] Handle UETT_OpenMPRequiredSimdAlign (PR #111259)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 5 08:46:47 PDT 2024


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/111259

None

>From f1313fbe249a8375aba9d5ead9440aef8b3fa9a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Sat, 5 Oct 2024 17:45:27 +0200
Subject: [PATCH] [clang][bytecode] Handle UETT_OpenMPRequiredSimdAlign

---
 clang/lib/AST/ByteCode/Compiler.cpp  | 7 +++++++
 clang/test/AST/ByteCode/builtins.cpp | 2 ++
 2 files changed, 9 insertions(+)

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);



More information about the cfe-commits mailing list