1 // REQUIRES: amdgpu-registered-target
2 // RUN: %clang -E -dM --offload-arch=gfx906 -mwavefrontsize64 \
3 // RUN: --cuda-device-only -nogpuinc -nogpulib \
4 // RUN: %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
5 // RUN: %clang -E -dM --offload-arch=gfx1010 -mwavefrontsize64 \
6 // RUN: --cuda-device-only -nogpuinc -nogpulib \
7 // RUN: %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
8 // RUN: %clang -E -dM --offload-arch=gfx906 -mwavefrontsize64 \
9 // RUN: --cuda-device-only -nogpuinc -nogpulib \
10 // RUN: -mno-wavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
11 // RUN: %clang -E -dM --offload-arch=gfx1010 -mwavefrontsize64 \
12 // RUN: --cuda-device-only -nogpuinc -nogpulib \
13 // RUN: -mno-wavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE32 %s
14 // RUN: %clang -E -dM --offload-arch=gfx906 -mno-wavefrontsize64 \
15 // RUN: --cuda-device-only -nogpuinc -nogpulib \
16 // RUN: -mwavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
17 // RUN: %clang -E -dM --offload-arch=gfx1010 -mno-wavefrontsize64 \
18 // RUN: --cuda-device-only -nogpuinc -nogpulib \
19 // RUN: -mwavefrontsize64 %s 2>&1 | FileCheck --check-prefixes=WAVE64 %s
20 // WAVE64-DAG: #define __AMDGCN_WAVEFRONT_SIZE__ 64
21 // WAVE32-DAG: #define __AMDGCN_WAVEFRONT_SIZE__ 32
22 // WAVE64-DAG: #define __AMDGCN_WAVEFRONT_SIZE 64
23 // WAVE32-DAG: #define __AMDGCN_WAVEFRONT_SIZE 32
25 // RUN: %clang -E -dM --offload-arch=gfx906 --cuda-device-only -nogpuinc -nogpulib \
26 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-ON %s
27 // RUN: %clang -E -dM --offload-arch=gfx906 --cuda-device-only -nogpuinc -nogpulib -mcumode \
28 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-ON %s
29 // RUN: %clang -E -dM --offload-arch=gfx906 --cuda-device-only -nogpuinc -nogpulib -mno-cumode \
30 // RUN: %s 2>&1 | FileCheck --check-prefixes=CUMODE-ON,WARN-CUMODE %s
31 // RUN: %clang -E -dM --offload-arch=gfx1030 --cuda-device-only -nogpuinc -nogpulib \
32 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-OFF %s
33 // RUN: %clang -E -dM --offload-arch=gfx1030 --cuda-device-only -nogpuinc -nogpulib -mcumode \
34 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-ON %s
35 // RUN: %clang -E -dM --offload-arch=gfx1030 --cuda-device-only -nogpuinc -nogpulib -mno-cumode \
36 // RUN: %s 2>&1 | FileCheck --check-prefix=CUMODE-OFF %s
38 // Check no duplicate warnings.
39 // RUN: %clang -E -dM --offload-arch=gfx906 --cuda-device-only -nogpuinc -nogpulib -mcumode \
40 // RUN: -mno-cumode -mno-cumode \
41 // RUN: %s 2>&1 | FileCheck --check-prefixes=CUMODE-ON,WARN-CUMODE %s
43 // WARN-CUMODE-DAG: warning: ignoring '-mno-cumode' option as it is not currently supported for processor 'gfx906' [-Woption-ignored]
44 // WARN-CUMODE-NOT: warning: ignoring '-mno-cumode' option as it is not currently supported for processor 'gfx906' [-Woption-ignored]
45 // CUMODE-ON-DAG: #define __AMDGCN_CUMODE__ 1
46 // CUMODE-OFF-DAG: #define __AMDGCN_CUMODE__ 0
48 // RUN: %clang -E -dM --offload-arch=gfx90a --cuda-device-only -nogpuinc -nogpulib \
49 // RUN: %s 2>&1 | FileCheck --check-prefixes=IMAGE,NOWARN %s
50 // RUN: %clang -E -dM --offload-arch=gfx1100 --cuda-device-only -nogpuinc -nogpulib \
51 // RUN: %s 2>&1 | FileCheck --check-prefixes=IMAGE,NOWARN %s
52 // RUN: %clang -E -dM --offload-arch=gfx940 --cuda-device-only -nogpuinc -nogpulib \
53 // RUN: %s 2>&1 | FileCheck --check-prefixes=NOIMAGE,NOWARN %s
54 // RUN: %clang -E -dM --offload-arch=gfx941 --cuda-device-only -nogpuinc -nogpulib \
55 // RUN: %s 2>&1 | FileCheck --check-prefixes=NOIMAGE,NOWARN %s
56 // RUN: %clang -E -dM --offload-arch=gfx942 --cuda-device-only -nogpuinc -nogpulib \
57 // RUN: %s 2>&1 | FileCheck --check-prefixes=NOIMAGE,NOWARN %s
58 // RUN: %clang -E -dM --offload-arch=gfx1100 --cuda-device-only -nogpuinc -nogpulib \
59 // RUN: -Xclang -target-feature -Xclang "-image-insts" %s 2>&1 | FileCheck --check-prefixes=IMAGE,WARN %s
60 // RUN: %clang -E -dM --offload-arch=gfx940 --cuda-device-only -nogpuinc -nogpulib \
61 // RUN: -Xclang -target-feature -Xclang "+image-insts" %s 2>&1 | FileCheck --check-prefixes=NOIMAGE,WARN %s
62 // NOWARN-NOT: warning
63 // WARN: warning: feature flag '{{[+|-]}}image-insts' is ignored since the feature is read only [-Winvalid-command-line-argument]
64 // IMAGE-NOT: #define __HIP_NO_IMAGE_SUPPORT__
65 // IMAGE-NOT: #define __HIP_NO_IMAGE_SUPPORT
66 // NOIMAGE-DAG: #define __HIP_NO_IMAGE_SUPPORT__ 1
67 // NOIMAGE-DAG: #define __HIP_NO_IMAGE_SUPPORT 1
69 // RUN: %clang -E -dM --offload-arch=gfx1100 -nogpuinc -nogpulib \
70 // RUN: -fgpu-default-stream=per-thread %s 2>&1 | FileCheck --check-prefixes=PTS %s
71 // RUN: %clang -E -dM --offload-arch=gfx940 --cuda-device-only -nogpuinc -nogpulib \
72 // RUN: -fgpu-default-stream=legacy %s 2>&1 | FileCheck --check-prefixes=NOPTS %s
73 // RUN: %clang -E -dM --offload-arch=gfx940 --cuda-device-only -nogpuinc -nogpulib \
74 // RUN: %s 2>&1 | FileCheck --check-prefixes=NOPTS %s
75 // PTS-DAG: #define __HIP_API_PER_THREAD_DEFAULT_STREAM__ 1
76 // PTS-DAG: #define __HIP_API_PER_THREAD_DEFAULT_STREAM__ 1
77 // PTS-DAG: #define HIP_API_PER_THREAD_DEFAULT_STREAM 1
78 // PTS-DAG: #define HIP_API_PER_THREAD_DEFAULT_STREAM 1
79 // NOPTS-NOT: #define __HIP_API_PER_THREAD_DEFAULT_STREAM__
80 // NOPTS-NOT: #define HIP_API_PER_THREAD_DEFAULT_STREAM
82 // RUN: %clang -E -dM --offload-arch=gfx906 -nogpuinc -nogpulib \
83 // RUN: %s 2>&1 | FileCheck --check-prefix=NOAPPROX %s
84 // RUN: %clang -E -dM --offload-arch=gfx906 -nogpuinc -nogpulib -fgpu-approx-transcendentals \
85 // RUN: %s 2>&1 | FileCheck --check-prefix=APPROX %s
86 // NOAPPROX-NOT: #define __CLANG_GPU_APPROX_TRANSCENDENTALS__
87 // APPROX: #define __CLANG_GPU_APPROX_TRANSCENDENTALS__ 1
88 // APPROX: #define __CLANG_GPU_APPROX_TRANSCENDENTALS__ 1