[clang] [Clang][TableGen] Add missing __bf16 type to the builtins parser (PR #120662)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 19 16:58:33 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Victor Mustya (vmustya)

<details>
<summary>Changes</summary>

The Clang tablegen built-in function prototype parser has the `__bf16`
type missing. This patch adds the missing type to the parser.

---
Full diff: https://github.com/llvm/llvm-project/pull/120662.diff


2 Files Affected:

- (modified) clang/test/TableGen/target-builtins-prototype-parser.td (+6-1) 
- (modified) clang/utils/TableGen/ClangBuiltinsEmitter.cpp (+1) 


``````````diff
diff --git a/clang/test/TableGen/target-builtins-prototype-parser.td b/clang/test/TableGen/target-builtins-prototype-parser.td
index 555aebb3ccfb1f..a753f906a674fe 100644
--- a/clang/test/TableGen/target-builtins-prototype-parser.td
+++ b/clang/test/TableGen/target-builtins-prototype-parser.td
@@ -57,6 +57,12 @@ def : Builtin {
   let Spellings = ["__builtin_08"];
 }
 
+def : Builtin {
+// CHECK: BUILTIN(__builtin_09, "V2yy", "")
+  let Prototype = "_Vector<2, __bf16>(__bf16)";
+  let Spellings = ["__builtin_09"];
+}
+
 #ifdef ERROR_EXPECTED_LANES
 def : Builtin {
 // ERROR_EXPECTED_LANES: :[[# @LINE + 1]]:7: error: Expected number of lanes after '_ExtVector<'
@@ -112,4 +118,3 @@ def : Builtin {
   let Spellings = ["__builtin_test_use_clang_extended_vectors"];
 }
 #endif
-
diff --git a/clang/utils/TableGen/ClangBuiltinsEmitter.cpp b/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
index 6c3604adc92b99..f8dec02ea12197 100644
--- a/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
+++ b/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
@@ -155,6 +155,7 @@ class PrototypeParser {
                                .Case("__fp16", "h")
                                .Case("__int128_t", "LLLi")
                                .Case("_Float16", "x")
+                               .Case("__bf16", "y")
                                .Case("bool", "b")
                                .Case("char", "c")
                                .Case("constant_CFString", "F")

``````````

</details>


https://github.com/llvm/llvm-project/pull/120662


More information about the cfe-commits mailing list