[clang] 60963fa - [HIP] Let clang recognize .hip extension
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 17 08:23:17 PDT 2020
Author: Yaxun (Sam) Liu
Date: 2020-03-17T11:22:55-04:00
New Revision: 60963fa630126f5a4554088e85ddaf8fff286cef
URL: https://github.com/llvm/llvm-project/commit/60963fa630126f5a4554088e85ddaf8fff286cef
DIFF: https://github.com/llvm/llvm-project/commit/60963fa630126f5a4554088e85ddaf8fff286cef.diff
LOG: [HIP] Let clang recognize .hip extension
Differential Revision: https://reviews.llvm.org/D76039
Added:
clang/test/CodeGenCUDA/hip-pinned-shadow.hip
Modified:
clang/lib/Frontend/FrontendOptions.cpp
clang/test/Driver/hip-autolink.hip
clang/test/Driver/hip-default-gpu-arch.hip
clang/test/Driver/hip-device-libs.hip
clang/test/Driver/hip-host-cpu-features.hip
clang/test/Driver/hip-no-device-libs.hip
clang/test/Driver/hip-output-file-name.hip
clang/test/Driver/hip-printf.hip
clang/test/Driver/hip-save-temps.hip
clang/test/Driver/hip-syntax-only.hip
clang/test/Driver/hip-toolchain-features.hip
clang/test/Driver/hip-toolchain-mllvm.hip
clang/test/Driver/hip-toolchain-opt.hip
Removed:
clang/test/CodeGenCUDA/hip-pinned-shadow.cu
################################################################################
diff --git a/clang/lib/Frontend/FrontendOptions.cpp b/clang/lib/Frontend/FrontendOptions.cpp
index 5c1fbf889c23..63088b95c310 100644
--- a/clang/lib/Frontend/FrontendOptions.cpp
+++ b/clang/lib/Frontend/FrontendOptions.cpp
@@ -30,6 +30,7 @@ InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) {
.Case("iim", InputKind(Language::CXX).getPreprocessed())
.Case("cl", Language::OpenCL)
.Case("cu", Language::CUDA)
+ .Case("hip", Language::HIP)
.Cases("ll", "bc", Language::LLVM_IR)
.Default(Language::Unknown);
}
diff --git a/clang/test/CodeGenCUDA/hip-pinned-shadow.cu b/clang/test/CodeGenCUDA/hip-pinned-shadow.hip
similarity index 81%
rename from clang/test/CodeGenCUDA/hip-pinned-shadow.cu
rename to clang/test/CodeGenCUDA/hip-pinned-shadow.hip
index 1d22ed6dc94c..7f0e7544d828 100644
--- a/clang/test/CodeGenCUDA/hip-pinned-shadow.cu
+++ b/clang/test/CodeGenCUDA/hip-pinned-shadow.hip
@@ -1,11 +1,11 @@
// REQUIRES: amdgpu-registered-target
// RUN: %clang_cc1 -triple amdgcn -fcuda-is-device -std=c++11 -fvisibility hidden -fapply-global-visibility-to-externs \
-// RUN: -emit-llvm -o - -x hip %s | FileCheck -check-prefixes=HIPDEV %s
+// RUN: -emit-llvm -o - %s | FileCheck -check-prefixes=HIPDEV %s
// RUN: %clang_cc1 -triple x86_64 -std=c++11 \
-// RUN: -emit-llvm -o - -x hip %s | FileCheck -check-prefixes=HIPHOST %s
+// RUN: -emit-llvm -o - %s | FileCheck -check-prefixes=HIPHOST %s
// RUN: %clang_cc1 -triple amdgcn -fcuda-is-device -std=c++11 -fvisibility hidden -fapply-global-visibility-to-externs \
-// RUN: -O3 -emit-llvm -o - -x hip %s | FileCheck -check-prefixes=HIPDEVUNSED %s
+// RUN: -O3 -emit-llvm -o - %s | FileCheck -check-prefixes=HIPDEVUNSED %s
struct textureReference {
int a;
diff --git a/clang/test/Driver/hip-autolink.hip b/clang/test/Driver/hip-autolink.hip
index 9c1b65f1592b..c06f0f9d8b71 100644
--- a/clang/test/Driver/hip-autolink.hip
+++ b/clang/test/Driver/hip-autolink.hip
@@ -3,9 +3,9 @@
// REQUIRES: amdgpu-registered-target
//
// RUN: %clang --target=i386-pc-windows-msvc --cuda-gpu-arch=gfx906 -nogpulib \
-// RUN: --cuda-device-only -x hip %s -### 2>&1 | FileCheck --check-prefix=DEV %s
+// RUN: --cuda-device-only %s -### 2>&1 | FileCheck --check-prefix=DEV %s
// RUN: %clang --target=i386-pc-windows-msvc --cuda-gpu-arch=gfx906 -nogpulib \
-// RUN: --cuda-host-only -x hip %s -### 2>&1 | FileCheck --check-prefix=HOST %s
+// RUN: --cuda-host-only %s -### 2>&1 | FileCheck --check-prefix=HOST %s
// DEV: "-cc1" "-triple" "amdgcn-amd-amdhsa"
// DEV-SAME: "-fno-autolink"
diff --git a/clang/test/Driver/hip-default-gpu-arch.hip b/clang/test/Driver/hip-default-gpu-arch.hip
index 56e36882dc63..bce9a67b4b1c 100644
--- a/clang/test/Driver/hip-default-gpu-arch.hip
+++ b/clang/test/Driver/hip-default-gpu-arch.hip
@@ -2,6 +2,6 @@
// REQUIRES: x86-registered-target
// REQUIRES: amdgpu-registered-target
-// RUN: %clang -### -x hip -c %s 2>&1 | FileCheck %s
+// RUN: %clang -### -c %s 2>&1 | FileCheck %s
// CHECK: {{.*}}clang{{.*}}"-target-cpu" "gfx803"
diff --git a/clang/test/Driver/hip-device-libs.hip b/clang/test/Driver/hip-device-libs.hip
index 97e76525dde8..b79cb70cbe68 100644
--- a/clang/test/Driver/hip-device-libs.hip
+++ b/clang/test/Driver/hip-device-libs.hip
@@ -5,7 +5,7 @@
// Test flush-denormals-to-zero enabled uses oclc_daz_opt_on
// RUN: %clang -### -target x86_64-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: --hip-device-lib-path=%S/Inputs/hip_dev_lib \
// RUN: -fcuda-flush-denormals-to-zero \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
@@ -14,7 +14,7 @@
// Test flush-denormals-to-zero disabled uses oclc_daz_opt_off
// RUN: %clang -### -target x86_64-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: --hip-device-lib-path=%S/Inputs/hip_dev_lib \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck %s --check-prefixes=COM,NOFLUSHD
@@ -23,7 +23,7 @@
// RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/hip_dev_lib \
// RUN: %clang -### -target x86_64-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck %s --check-prefixes=COM
diff --git a/clang/test/Driver/hip-host-cpu-features.hip b/clang/test/Driver/hip-host-cpu-features.hip
index efadd8bed22c..67a500455691 100644
--- a/clang/test/Driver/hip-host-cpu-features.hip
+++ b/clang/test/Driver/hip-host-cpu-features.hip
@@ -2,9 +2,9 @@
// REQUIRES: x86-registered-target
// REQUIRES: amdgpu-registered-target
-// RUN: %clang -### -c -target x86_64-linux-gnu -march=znver2 -x hip --cuda-gpu-arch=gfx803 -nogpulib %s 2>&1 | FileCheck %s -check-prefix=HOSTCPU
-// RUN: %clang -### -c -target x86_64-linux-gnu -msse3 -x hip --cuda-gpu-arch=gfx803 -nogpulib %s 2>&1 | FileCheck %s -check-prefix=HOSTSSE3
-// RUN: %clang -### -c -target x86_64-linux-gnu --gpu-use-aux-triple-only -march=znver2 -x hip --cuda-gpu-arch=gfx803 -nogpulib %s 2>&1 | FileCheck %s -check-prefix=NOHOSTCPU
+// RUN: %clang -### -c -target x86_64-linux-gnu -march=znver2 --cuda-gpu-arch=gfx803 -nogpulib %s 2>&1 | FileCheck %s -check-prefix=HOSTCPU
+// RUN: %clang -### -c -target x86_64-linux-gnu -msse3 --cuda-gpu-arch=gfx803 -nogpulib %s 2>&1 | FileCheck %s -check-prefix=HOSTSSE3
+// RUN: %clang -### -c -target x86_64-linux-gnu --gpu-use-aux-triple-only -march=znver2 --cuda-gpu-arch=gfx803 -nogpulib %s 2>&1 | FileCheck %s -check-prefix=NOHOSTCPU
// HOSTCPU: "-cc1" "-triple" "amdgcn-amd-amdhsa"
// HOSTCPU-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
diff --git a/clang/test/Driver/hip-no-device-libs.hip b/clang/test/Driver/hip-no-device-libs.hip
index 9fc73699d515..d19382698bb1 100644
--- a/clang/test/Driver/hip-no-device-libs.hip
+++ b/clang/test/Driver/hip-no-device-libs.hip
@@ -3,7 +3,7 @@
// REQUIRES: amdgpu-registered-target
// RUN: %clang -### -nogpulib -target x86_64-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck %s
diff --git a/clang/test/Driver/hip-output-file-name.hip b/clang/test/Driver/hip-output-file-name.hip
index cce9f76406ee..d57f7e87f89e 100644
--- a/clang/test/Driver/hip-output-file-name.hip
+++ b/clang/test/Driver/hip-output-file-name.hip
@@ -3,7 +3,7 @@
// REQUIRES: amdgpu-registered-target
// RUN: %clang -### -c -target x86_64-linux-gnu -fgpu-rdc \
-// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
+// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
// RUN: 2>&1 | FileCheck %s
// CHECK: {{.*}}clang-offload-bundler{{.*}}"-outputs=hip-output-file-name.o"
diff --git a/clang/test/Driver/hip-printf.hip b/clang/test/Driver/hip-printf.hip
index ada6c651ddb7..065398a214f1 100644
--- a/clang/test/Driver/hip-printf.hip
+++ b/clang/test/Driver/hip-printf.hip
@@ -2,7 +2,7 @@
// REQUIRES: x86-registered-target
// REQUIRES: amdgpu-registered-target
-// RUN: %clang -### -target x86_64-linux-gnu -x hip --cuda-gpu-arch=gfx900 \
+// RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=gfx900 \
// RUN: %s 2>&1 | FileCheck %s
// CHECK: [[CLANG:".*clang.*"]] "-cc1"
diff --git a/clang/test/Driver/hip-save-temps.hip b/clang/test/Driver/hip-save-temps.hip
index f7f2c6ef57ff..e9a8bd1f2099 100644
--- a/clang/test/Driver/hip-save-temps.hip
+++ b/clang/test/Driver/hip-save-temps.hip
@@ -4,22 +4,22 @@
// -fno-gpu-rdc without -o
// RUN: %clang -### -target x86_64-linux-gnu -nogpulib -save-temps \
-// RUN: -x hip --cuda-gpu-arch=gfx900 %s 2>&1 | \
+// RUN: --cuda-gpu-arch=gfx900 %s 2>&1 | \
// RUN: FileCheck -check-prefixes=CHECK,NORDC,NOUT %s
// -fno-gpu-rdc with -o
// RUN: %clang -### -target x86_64-linux-gnu -nogpulib -save-temps \
-// RUN: -o executable -x hip --cuda-gpu-arch=gfx900 %s 2>&1 | \
+// RUN: -o executable --cuda-gpu-arch=gfx900 %s 2>&1 | \
// RUN: FileCheck -check-prefixes=CHECK,NORDC,WOUT %s
// -fgpu-rdc without -o
// RUN: %clang -### -target x86_64-linux-gnu -nogpulib -save-temps \
-// RUN: -fgpu-rdc -x hip --cuda-gpu-arch=gfx900 %s 2>&1 | \
+// RUN: -fgpu-rdc --cuda-gpu-arch=gfx900 %s 2>&1 | \
// RUN: FileCheck -check-prefixes=CHECK,RDC,RDC-NOUT,NOUT %s
// -fgpu-rdc with -o
// RUN: %clang -### -target x86_64-linux-gnu -nogpulib -save-temps \
-// RUN: -o executable -fgpu-rdc -x hip --cuda-gpu-arch=gfx900 %s 2>&1 | \
+// RUN: -o executable -fgpu-rdc --cuda-gpu-arch=gfx900 %s 2>&1 | \
// RUN: FileCheck -check-prefixes=CHECK,RDC,RDC-WOUT,WOUT %s
// CHECK: {{.*}}clang{{.*}}"-o" "hip-save-temps-hip-amdgcn-amd-amdhsa-gfx900.cui"
diff --git a/clang/test/Driver/hip-syntax-only.hip b/clang/test/Driver/hip-syntax-only.hip
index 051c3c68962e..e52acb0344ef 100644
--- a/clang/test/Driver/hip-syntax-only.hip
+++ b/clang/test/Driver/hip-syntax-only.hip
@@ -2,7 +2,7 @@
// REQUIRES: x86-registered-target
// REQUIRES: amdgpu-registered-target
-// RUN: %clang -### -x hip -nogpulib -target x86_64 -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang -### -nogpulib -target x86_64 -fsyntax-only %s 2>&1 | FileCheck %s
// Check that there are commands for both host- and device-side compilations.
//
diff --git a/clang/test/Driver/hip-toolchain-features.hip b/clang/test/Driver/hip-toolchain-features.hip
index 0fe94015ef1e..3b90d4101ee3 100644
--- a/clang/test/Driver/hip-toolchain-features.hip
+++ b/clang/test/Driver/hip-toolchain-features.hip
@@ -3,10 +3,10 @@
// REQUIRES: amdgpu-registered-target
// RUN: %clang -### -c -target x86_64-linux-gnu -fgpu-rdc \
-// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
+// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
// RUN: -mxnack 2>&1 | FileCheck %s -check-prefix=XNACK
// RUN: %clang -### -c -target x86_64-linux-gnu -fgpu-rdc \
-// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
+// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
// RUN: -mno-xnack 2>&1 | FileCheck %s -check-prefix=NOXNACK
// XNACK: {{.*}}clang{{.*}}"-target-feature" "+xnack"
@@ -14,10 +14,10 @@
// RUN: %clang -### -c -target x86_64-linux-gnu -fgpu-rdc \
-// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
+// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
// RUN: -msram-ecc 2>&1 | FileCheck %s -check-prefix=SRAM
// RUN: %clang -### -c -target x86_64-linux-gnu -fgpu-rdc \
-// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
+// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
// RUN: -mno-sram-ecc 2>&1 | FileCheck %s -check-prefix=NOSRAM
// SRAM: {{.*}}clang{{.*}}"-target-feature" "+sram-ecc"
@@ -25,11 +25,11 @@
// RUN: %clang -### -c -target x86_64-linux-gnu -fgpu-rdc \
-// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
+// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
// RUN: -mxnack -msram-ecc \
// RUN: 2>&1 | FileCheck %s -check-prefix=ALL3
// RUN: %clang -### -c -target x86_64-linux-gnu -fgpu-rdc \
-// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
+// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
// RUN: -mno-xnack -mno-sram-ecc \
// RUN: 2>&1 | FileCheck %s -check-prefix=NOALL3
diff --git a/clang/test/Driver/hip-toolchain-mllvm.hip b/clang/test/Driver/hip-toolchain-mllvm.hip
index ab665055f482..692a9a7d5c70 100644
--- a/clang/test/Driver/hip-toolchain-mllvm.hip
+++ b/clang/test/Driver/hip-toolchain-mllvm.hip
@@ -3,7 +3,7 @@
// REQUIRES: amdgpu-registered-target
// RUN: %clang -### -target x86_64-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
// RUN: -mllvm -amdgpu-function-calls=0 \
// RUN: %s 2>&1 | FileCheck %s
diff --git a/clang/test/Driver/hip-toolchain-opt.hip b/clang/test/Driver/hip-toolchain-opt.hip
index ae64ae7d0d0f..c6d6bf561cde 100644
--- a/clang/test/Driver/hip-toolchain-opt.hip
+++ b/clang/test/Driver/hip-toolchain-opt.hip
@@ -4,56 +4,56 @@
// RUN: %clang -### \
// RUN: -target x86_64-unknown-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: -c -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck --check-prefixes=ALL,DEFAULT %s
// RUN: %clang -### -O0 \
// RUN: -target x86_64-unknown-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: -c -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck --check-prefixes=ALL,O0 %s
// RUN: %clang -### -O1 \
// RUN: -target x86_64-unknown-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: -c -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck --check-prefixes=ALL,O1 %s
// RUN: %clang -### -O2 \
// RUN: -target x86_64-unknown-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: -c -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck --check-prefixes=ALL,O2 %s
// RUN: %clang -### -O3 \
// RUN: -target x86_64-unknown-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: -c -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck --check-prefixes=ALL,O3 %s
// RUN: %clang -### -Os \
// RUN: -target x86_64-unknown-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: -c -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck --check-prefixes=ALL,Os %s
// RUN: %clang -### -Oz \
// RUN: -target x86_64-unknown-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: -c -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck --check-prefixes=ALL,Oz %s
// RUN: %clang -### -Og \
// RUN: -target x86_64-unknown-linux-gnu \
-// RUN: -x hip --cuda-gpu-arch=gfx900 \
+// RUN: --cuda-gpu-arch=gfx900 \
// RUN: -c -nogpulib \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck --check-prefixes=ALL,Og %s
More information about the cfe-commits
mailing list