Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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())
Expand Down
30 changes: 15 additions & 15 deletions clang/test/Driver/amdgpu-toolchain-opencl.cl
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/opencl.cl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/TargetParser/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ class Triple {
Serenity,
Vulkan, // Vulkan SPIR-V
CheriotRTOS,
LastOSType = CheriotRTOS
OpenCL,
LastOSType = OpenCL
};
enum EnvironmentType {
UnknownEnvironment,
Expand Down Expand Up @@ -308,7 +309,6 @@ class Triple {
Mesh,
Amplification,
RootSignature,
OpenCL,
OpenHOS,
Mlibc,

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/TargetParser/Triple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ StringRef Triple::getOSTypeName(OSType Kind) {
case Vulkan: return "vulkan";
case CheriotRTOS:
return "cheriotrtos";
case OpenCL:
return "opencl";
}

llvm_unreachable("Invalid OSType");
Expand Down Expand Up @@ -395,8 +397,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";
Expand Down Expand Up @@ -742,6 +742,7 @@ static Triple::OSType parseOS(StringRef OSName) {
.StartsWith("serenity", Triple::Serenity)
.StartsWith("vulkan", Triple::Vulkan)
.StartsWith("cheriotrtos", Triple::CheriotRTOS)
.StartsWith("opencl", Triple::OpenCL)
.Default(Triple::UnknownOS);
}

Expand Down Expand Up @@ -795,7 +796,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)
Expand Down
Loading