Skip to content

Commit 4fedbbd

Browse files
committed
Enable bf16 arithmetic for all subtargets.
1 parent 33e0843 commit 4fedbbd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

clang/lib/Basic/Targets/AMDGPU.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
439439
// pre-defined macros.
440440
bool handleTargetFeatures(std::vector<std::string> &Features,
441441
DiagnosticsEngine &Diags) override {
442+
HasFullBFloat16 = true;
442443
auto TargetIDFeatures =
443444
getAllPossibleTargetIDFeatures(getTriple(), getArchNameAMDGCN(GPUKind));
444445
for (const auto &F : Features) {
@@ -451,8 +452,6 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
451452
CUMode = false;
452453
else if (F == "+image-insts")
453454
HasImage = true;
454-
else if (F == "+gfx950-insts" || F == "+gfx1250-insts")
455-
HasFullBFloat16 = true;
456455
bool IsOn = F.front() == '+';
457456
StringRef Name = StringRef(F).drop_front();
458457
if (!llvm::is_contained(TargetIDFeatures, Name))

clang/test/CodeGen/AMDGPU/full-bf16.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa-gnu -target-cpu tahiti -emit-llvm -o - %s | FileCheck %s
3+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa-gnu -target-cpu fiji -emit-llvm -o - %s | FileCheck %s
4+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa-gnu -target-cpu gfx900 -emit-llvm -o - %s | FileCheck %s
25
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa-gnu -target-cpu gfx950 -emit-llvm -o - %s | FileCheck %s
6+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa-gnu -target-cpu gfx1010 -emit-llvm -o - %s | FileCheck %s
7+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa-gnu -target-cpu gfx1100 -emit-llvm -o - %s | FileCheck %s
38
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa-gnu -target-cpu gfx1250 -emit-llvm -o - %s | FileCheck %s
49

510
// CHECK-LABEL: define dso_local bfloat @div(

0 commit comments

Comments
 (0)