Skip to content

[Clang][TableGen] Add missing __bf16 type to the builtins parser #120662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

vmustya
Copy link
Contributor

@vmustya vmustya commented Dec 20, 2024

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

The Clang tablegen built-in function prototype parser has the `__bf16`
type missing. This patch adds the missing type to the parser.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Dec 20, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 20, 2024

@llvm/pr-subscribers-clang

Author: Victor Mustya (vmustya)

Changes

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

@philnik777
Copy link
Contributor

Do you plan to use it somewhere?

@vmustya
Copy link
Contributor Author

vmustya commented Dec 20, 2024

Do you plan to use it somewhere?

@philnik777, currently I plan to use it for some downstream projects, but I believe it might be useful for in-tree targets as well.

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@michalpaszkowski michalpaszkowski merged commit f764e71 into llvm:main Jan 9, 2025
10 checks passed
BaiXilin pushed a commit to BaiXilin/llvm-fix-vnni-instr-types that referenced this pull request Jan 12, 2025
…m#120662)

The Clang tablegen built-in function prototype parser has the `__bf16`
type missing. This patch adds the missing type to the parser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants