File tree Expand file tree Collapse file tree 4 files changed +21
-5
lines changed Expand file tree Collapse file tree 4 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,18 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
8484 return TT.getArch () == llvm::Triple::r600;
8585 }
8686
87+ bool hasFlatSupport () const {
88+ if (GPUKind >= llvm::AMDGPU::GK_GFX700)
89+ return true ;
90+
91+ // Dummy target is assumed to be gfx700+ for amdhsa.
92+ if (GPUKind == llvm::AMDGPU::GK_NONE &&
93+ getTriple ().getOS () == llvm::Triple::AMDHSA)
94+ return true ;
95+
96+ return false ;
97+ }
98+
8799public:
88100 AMDGPUTargetInfo (const llvm::Triple &Triple, const TargetOptions &Opts);
89101
@@ -325,7 +337,7 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
325337 Opts[" __opencl_c_atomic_order_seq_cst" ] = true ;
326338 Opts[" __opencl_c_atomic_scope_all_devices" ] = true ;
327339
328- if (GPUKind >= llvm::AMDGPU::GK_GFX700 ) {
340+ if (hasFlatSupport () ) {
329341 Opts[" __opencl_c_generic_address_space" ] = true ;
330342 Opts[" __opencl_c_device_enqueue" ] = true ;
331343 }
Original file line number Diff line number Diff line change 22// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -cl-ext=-all -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
33// RUN: %clang_cc1 %s -O0 -cl-std=clc++2021 -cl-ext=-all -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
44// RUN: %clang_cc1 %s -O0 -DCL20 -cl-std=CL2.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20SPIR
5- // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
6- // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -cl-std=CL3.0 -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
5+ // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
6+ // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-mesa3d -cl-std=CL3.0 -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
77// RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -DCL20 -cl-std=CL2.0 -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20AMDGCN
8+ // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -DCL20 -cl-std=CL3.0 -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20AMDGCN
89// RUN: %clang_cc1 %s -O0 -triple amdgcn-mesa-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
910// RUN: %clang_cc1 %s -O0 -triple amdgcn-mesa-mesa3d -cl-std=CL3.0 -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
1011// RUN: %clang_cc1 %s -O0 -triple r600-- -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
Original file line number Diff line number Diff line change 33// RUN: -emit-llvm -o - | FileCheck --check-prefixes=OPENCL12 %s
44// RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -cl-std=CL2.0 \
55// RUN: -emit-llvm -o - | FileCheck --check-prefixes=OPENCL20 %s
6- // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -cl-std=CL3.0 \
6+ // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-mesa3d -target-cpu gfx600 -cl-std=CL3.0 \
77// RUN: -emit-llvm -o - | FileCheck --check-prefixes=OPENCL30 %s
8- // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -cl-std=CL3.0 -cl-ext=+__opencl_c_generic_address_space \
8+ // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -cl-std=CL3.0 \
99// RUN: -emit-llvm -o - | FileCheck --check-prefixes=OPENCL30GAS %s
1010
1111// OPENCL-LABEL: define dso_local void @test1_builtin_alloca(
Original file line number Diff line number Diff line change 1111// RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
1212// RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple amdgcn-unknown-unknown -target-cpu gfx700 -Wpedantic-core-features -DTEST_CORE_FEATURES -DFLAT_SUPPORT
1313
14+ // Test none target with amdhsa triple, which implies >= gfx700
15+ // RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple amdgcn-unknown-amdhsa -Wpedantic-core-features -DTEST_CORE_FEATURES -DFLAT_SUPPORT
16+
1417// Extensions in all versions
1518#ifndef cl_clang_storage_class_specifiers
1619#error "Missing cl_clang_storage_class_specifiers define"
You can’t perform that action at this time.
0 commit comments