Skip to content

Commit

Permalink
[X86][BF16] Add type mangling for Windows
Browse files Browse the repository at this point in the history
Reviewed By: FreddyYe

Differential Revision: https://reviews.llvm.org/D132742
  • Loading branch information
phoebewang committed Aug 29, 2022
1 parent db6f8eb commit a845d8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion clang/lib/AST/MicrosoftMangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down
9 changes: 6 additions & 3 deletions clang/test/CodeGen/X86/bfloat-mangle.cpp
Original file line number Diff line number Diff line change
@@ -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@__clang@@@Z"(bfloat noundef %b)
void foo(__bf16 b) {}

0 comments on commit a845d8f

Please sign in to comment.