Skip to content

Commit 2765739

Browse files
committed
Add tests.
1 parent 5cd1abb commit 2765739

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Check that if we are compiling with fgpu-rdc amdgpu-enable-hipstdpar is not
2+
// passed to CC1, to avoid eager, per TU, removal of potentially accessible
3+
// functions.
4+
5+
// RUN: %clang -### --hipstdpar --offload-arch=gfx906 %s -nogpulib -nogpuinc \
6+
// RUN: 2>&1 | FileCheck -check-prefix=NORDC %s
7+
// NORDC: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* "-mllvm" "-amdgpu-enable-hipstdpar".*}}
8+
9+
// RUN: %clang -### --hipstdpar --offload-arch=gfx906 %s -nogpulib -nogpuinc -fgpu-rdc \
10+
// RUN: 2>&1 | FileCheck -check-prefix=RDC %s
11+
// RDC-NOT: {{"-mllvm" "-amdgpu-enable-hipstdpar".*}}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Test that the accelerator code selection pass only gets invoked after linking
2+
3+
// Ensure Pass HipStdParAcceleratorCodeSelectionPass is not invoked in PreLink.
4+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -mllvm -amdgpu-enable-hipstdpar -flto -emit-llvm-bc -fcuda-is-device -fdebug-pass-manager \
5+
// RUN: %s -o - 2>&1 | FileCheck --check-prefix=HIPSTDPAR-PRE %s
6+
// HIPSTDPAR-PRE-NOT: Running pass: HipStdParAcceleratorCodeSelectionPass
7+
8+
// Ensure Pass HipStdParAcceleratorCodeSelectionPass is invoked in PostLink.
9+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -mllvm -amdgpu-enable-hipstdpar -fcuda-is-device -fdebug-pass-manager -emit-llvm \
10+
// RUN: %s -o - 2>&1 | FileCheck --check-prefix=HIPSTDPAR-POST %s
11+
// HIPSTDPAR-POST: Running pass: HipStdParAcceleratorCodeSelection
12+
13+
#define __device__ __attribute__((device))
14+
15+
void foo(float *a, float b) {
16+
*a = b;
17+
}
18+
19+
__device__ void bar(float *a, float b) {
20+
*a = b;
21+
}

0 commit comments

Comments
 (0)