[clang] [llvm] [AMDGPU] Use `bf16` instead of `i16` for bfloat (PR #80908)

Jay Foad via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 16 09:46:22 PST 2024


================
@@ -157,6 +157,27 @@ static uint32_t getLit16Encoding(uint16_t Val, const MCSubtargetInfo &STI) {
   return 255;
 }
 
+static uint32_t getLitBF16Encoding(uint16_t Val) {
+  uint16_t IntImm = getIntInlineImmEncoding(static_cast<int16_t>(Val));
+  if (IntImm != 0)
+    return IntImm;
+
+  // clang-format off
+  switch (Val) {
----------------
jayfoad wrote:

Yeah, I really don't like having 4 different copies of this list of hex values (0x3f00, 0xbf00...).

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


More information about the cfe-commits mailing list