Make OpenCL an OSType rather than an EnvironmentType. (#170297)
OpenCL was added as an `EnvironmentType` in https://github.com/llvm/llvm-project/pull/78655, but there is no explanation as to why it was added as such, even after explicitly asking in the PR (https://github.com/llvm/llvm-project/pull/78655#issuecomment-2743162853). This PR makes it an `OSType` instead, which feels more natural, and updates tests accordingly. --------- Co-authored-by: Marcos Maronas <marcos.maronas@intel.com>
This commit is contained in:
parent
cdbe28887b
commit
ce94d63f0f
@ -1,6 +1,6 @@
|
||||
// REQUIRES: amdgpu-registered-target
|
||||
// RUN: %clang -cl-std=CL2.0 -emit-llvm -g -O0 -S -nogpulib -target amdgcn-amd-amdhsa -mcpu=fiji -o - %s | FileCheck %s
|
||||
// RUN: %clang -cl-std=CL2.0 -emit-llvm -g -O0 -S -nogpulib -target amdgcn-amd-amdhsa-opencl -mcpu=fiji -o - %s | FileCheck %s
|
||||
// RUN: %clang -cl-std=CL2.0 -emit-llvm -g -O0 -S -nogpulib -target amdgcn-amd-amdhsa -mcpu=fiji -o - %s | FileCheck %s
|
||||
|
||||
// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_GLOBAL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}})
|
||||
// CHECK-DAG: ![[DWARF_ADDRESS_SPACE_LOCAL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{[0-9]+}}, size: {{[0-9]+}}, dwarfAddressSpace: 3)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// REQUIRES: amdgpu-registered-target
|
||||
// RUN: %clang -cl-std=CL2.0 -emit-llvm -g -O0 -S -nogpulib -target amdgcn-amd-amdhsa -mcpu=fiji -o - %s | FileCheck %s
|
||||
// RUN: %clang -cl-std=CL2.0 -emit-llvm -g -O0 -S -nogpulib -target amdgcn-amd-amdhsa-opencl -mcpu=fiji -o - %s | FileCheck %s
|
||||
// RUN: %clang -cl-std=CL2.0 -emit-llvm -g -O0 -S -nogpulib -target amdgcn-amd-amdhsa -mcpu=fiji -o - %s | FileCheck %s
|
||||
|
||||
// CHECK-DAG: ![[FILEVAR0:[0-9]+]] = distinct !DIGlobalVariable(name: "FileVar0", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}}, isLocal: false, isDefinition: true)
|
||||
// CHECK-DAG: !DIGlobalVariableExpression(var: ![[FILEVAR0]], expr: !DIExpression())
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O0 %s 2>&1 | FileCheck -check-prefix=CHECK_O0 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O1 %s 2>&1 | FileCheck -check-prefix=CHECK_O1 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O2 %s 2>&1 | FileCheck -check-prefix=CHECK_O2 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O3 %s 2>&1 | FileCheck -check-prefix=CHECK_O3 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O4 %s 2>&1 | FileCheck -check-prefix=CHECK_O4 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O5 %s 2>&1 | FileCheck -check-prefix=CHECK_O5 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib -Og %s 2>&1 | FileCheck -check-prefix=CHECK_Og %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK_Ofast %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHECK_O_DEFAULT %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O0 %s 2>&1 | FileCheck -check-prefix=CHECK_O0 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O1 %s 2>&1 | FileCheck -check-prefix=CHECK_O1 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O2 %s 2>&1 | FileCheck -check-prefix=CHECK_O2 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O3 %s 2>&1 | FileCheck -check-prefix=CHECK_O3 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O4 %s 2>&1 | FileCheck -check-prefix=CHECK_O4 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib -O5 %s 2>&1 | FileCheck -check-prefix=CHECK_O5 %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib -Og %s 2>&1 | FileCheck -check-prefix=CHECK_Og %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK_Ofast %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHECK_O_DEFAULT %s
|
||||
|
||||
// Check default include file is not included for preprocessor output.
|
||||
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHK-INC %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib -save-temps %s 2>&1 | FileCheck -check-prefix=CHK-INC %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHK-INC %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib -save-temps %s 2>&1 | FileCheck -check-prefix=CHK-INC %s
|
||||
|
||||
// CHECK_O0: "-cc1"{{.*}} "-O0"
|
||||
// CHECK_O1: "-cc1"{{.*}} "-O1"
|
||||
@ -26,14 +26,14 @@
|
||||
// CHK-INC: "-cc1" {{.*}}"-finclude-default-header" "-fdeclare-opencl-builtins" {{.*}}"-x" "cl"
|
||||
// CHK-INC-NOT: "-cc1" {{.*}}"-finclude-default-header" "-fdeclare-opencl-builtins" {{.*}}"-x" "cpp-output"
|
||||
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHK-LINK %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHK-LINK %s
|
||||
// CHK-LINK: ld.lld{{.*}} "--no-undefined" "-shared"
|
||||
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -Wl,--unresolved-symbols=ignore-all -x cl -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHK-LINK_UR %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -Xlinker --unresolved-symbols=ignore-all -x cl -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHK-LINK_UR %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -Wl,--unresolved-symbols=ignore-all -x cl -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHK-LINK_UR %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -Xlinker --unresolved-symbols=ignore-all -x cl -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHK-LINK_UR %s
|
||||
// CHK-LINK_UR: ld.lld{{.*}} "--no-undefined"{{.*}} "--unresolved-symbols=ignore-all"
|
||||
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa-opencl -x cl -c -emit-llvm -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHECK-WARN-ATOMIC %s
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji -nogpulib %s 2>&1 | FileCheck -check-prefix=CHECK-WARN-ATOMIC %s
|
||||
// CHECK-WARN-ATOMIC: "-cc1"{{.*}} "-Werror=atomic-alignment"
|
||||
|
||||
// RUN: %clang -### --target=amdgcn-amd-amdhsa -x cl -c -emit-llvm -mcpu=fiji %s 2>&1 \
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
// RUN: not %clang -cl-std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s
|
||||
// RUN: not %clang -cl-std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s
|
||||
// RUN: %clang -S -### --target=spir %s 2>&1 | FileCheck --check-prefix=CHECK-W-SPIR-COMPAT %s
|
||||
// RUN: %clang -S -### --target=amdgcn-amd-amdhsa-opencl -nogpuinc -nogpulib %s 2>&1 | FileCheck --check-prefix=CHECK-NO-W-SPIR-COMPAT %s
|
||||
// RUN: %clang -S -### --target=amdgcn-amd-amdhsa -nogpuinc -nogpulib %s 2>&1 | FileCheck --check-prefix=CHECK-NO-W-SPIR-COMPAT %s
|
||||
// RUN: %clang -S -### -cl-ext="+test_ext" %s 2>&1 | FileCheck --check-prefix=CHECK-EXT %s
|
||||
|
||||
// CHECK-CL: "-cc1" {{.*}} "-cl-std=CL"
|
||||
|
||||
@ -252,6 +252,7 @@ public:
|
||||
Serenity,
|
||||
Vulkan, // Vulkan SPIR-V
|
||||
CheriotRTOS,
|
||||
OpenCL,
|
||||
ChipStar,
|
||||
Firmware,
|
||||
LastOSType = Firmware
|
||||
@ -314,7 +315,6 @@ public:
|
||||
Mesh,
|
||||
Amplification,
|
||||
RootSignature,
|
||||
OpenCL,
|
||||
OpenHOS,
|
||||
Mlibc,
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ SPIRVSubtarget::SPIRVSubtarget(const Triple &TT, const std::string &CPU,
|
||||
// Set the environment based on the target triple.
|
||||
if (TargetTriple.getOS() == Triple::Vulkan)
|
||||
Env = Shader;
|
||||
else if (TargetTriple.getEnvironment() == Triple::OpenCL ||
|
||||
else if (TargetTriple.getOS() == Triple::OpenCL ||
|
||||
TargetTriple.getVendor() == Triple::AMD)
|
||||
Env = Kernel;
|
||||
else
|
||||
|
||||
@ -341,6 +341,8 @@ StringRef Triple::getOSTypeName(OSType Kind) {
|
||||
case Vulkan: return "vulkan";
|
||||
case CheriotRTOS:
|
||||
return "cheriotrtos";
|
||||
case OpenCL:
|
||||
return "opencl";
|
||||
case ChipStar:
|
||||
return "chipstar";
|
||||
case Firmware:
|
||||
@ -407,8 +409,6 @@ StringRef Triple::getEnvironmentTypeName(EnvironmentType Kind) {
|
||||
case Amplification: return "amplification";
|
||||
case RootSignature:
|
||||
return "rootsignature";
|
||||
case OpenCL:
|
||||
return "opencl";
|
||||
case OpenHOS: return "ohos";
|
||||
case PAuthTest:
|
||||
return "pauthtest";
|
||||
@ -758,6 +758,7 @@ static Triple::OSType parseOS(StringRef OSName) {
|
||||
.StartsWith("serenity", Triple::Serenity)
|
||||
.StartsWith("vulkan", Triple::Vulkan)
|
||||
.StartsWith("cheriotrtos", Triple::CheriotRTOS)
|
||||
.StartsWith("opencl", Triple::OpenCL)
|
||||
.StartsWith("chipstar", Triple::ChipStar)
|
||||
.StartsWith("firmware", Triple::Firmware)
|
||||
.Default(Triple::UnknownOS);
|
||||
@ -813,7 +814,6 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
|
||||
.StartsWith("mesh", Triple::Mesh)
|
||||
.StartsWith("amplification", Triple::Amplification)
|
||||
.StartsWith("rootsignature", Triple::RootSignature)
|
||||
.StartsWith("opencl", Triple::OpenCL)
|
||||
.StartsWith("ohos", Triple::OpenHOS)
|
||||
.StartsWith("pauthtest", Triple::PAuthTest)
|
||||
.StartsWith("llvm", Triple::LLVM)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user