[clang] a845d8f - [X86][BF16] Add type mangling for Windows
Phoebe Wang via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 29 01:12:39 PDT 2022
Author: Phoebe Wang
Date: 2022-08-29T16:12:26+08:00
New Revision: a845d8fc57b6b09198bcb104f060925298034636
URL: https://github.com/llvm/llvm-project/commit/a845d8fc57b6b09198bcb104f060925298034636
DIFF: https://github.com/llvm/llvm-project/commit/a845d8fc57b6b09198bcb104f060925298034636.diff
LOG: [X86][BF16] Add type mangling for Windows
Reviewed By: FreddyYe
Differential Revision: https://reviews.llvm.org/D132742
Added:
Modified:
clang/lib/AST/MicrosoftMangle.cpp
clang/test/CodeGen/X86/bfloat-mangle.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index 09075e60142a7..e58fedb6fa54c 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -2469,6 +2469,10 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T, Qualifiers,
Out << "$halff@";
break;
+ case BuiltinType::BFloat16:
+ mangleArtificialTagType(TTK_Struct, "__bf16", {"__clang"});
+ break;
+
#define SVE_TYPE(Name, Id, SingletonId) \
case BuiltinType::Id:
#include "clang/Basic/AArch64SVEACLETypes.def"
@@ -2501,7 +2505,6 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T, Qualifiers,
case BuiltinType::SatUShortFract:
case BuiltinType::SatUFract:
case BuiltinType::SatULongFract:
- case BuiltinType::BFloat16:
case BuiltinType::Ibm128:
case BuiltinType::Float128: {
DiagnosticsEngine &Diags = Context.getDiags();
diff --git a/clang/test/CodeGen/X86/bfloat-mangle.cpp b/clang/test/CodeGen/X86/bfloat-mangle.cpp
index 2892a76d8d910..acc6c280f2e8e 100644
--- a/clang/test/CodeGen/X86/bfloat-mangle.cpp
+++ b/clang/test/CodeGen/X86/bfloat-mangle.cpp
@@ -1,5 +1,8 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -target-feature +sse2 -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-feature +sse2 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -target-feature +sse2 -emit-llvm -o - %s | FileCheck %s --check-prefixes=LINUX
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-feature +sse2 -emit-llvm -o - %s | FileCheck %s --check-prefixes=LINUX
+// RUN: %clang_cc1 -triple i386-windows-msvc -target-feature +sse2 -emit-llvm -o - %s | FileCheck %s --check-prefixes=WINDOWS
+// RUN: %clang_cc1 -triple x86_64-windows-msvc -target-feature +sse2 -emit-llvm -o - %s | FileCheck %s --check-prefixes=WINDOWS
-// CHECK: define {{.*}}void @_Z3foou6__bf16(bfloat noundef %b)
+// LINUX: define {{.*}}void @_Z3foou6__bf16(bfloat noundef %b)
+// WINDOWS: define {{.*}}void @"?foo@@YAXU__bf16 at __clang@@@Z"(bfloat noundef %b)
void foo(__bf16 b) {}
More information about the cfe-commits
mailing list