• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// REQUIRES: clang-driver
2// REQUIRES: amdgpu-registered-target
3// REQUIRES: !system-windows
4
5// Test flush-denormals-to-zero enabled uses oclc_daz_opt_on
6
7// RUN: %clang -### -target amdgcn-amd-amdhsa \
8// RUN:   -x cl -mcpu=gfx900 \
9// RUN:   --rocm-path=%S/Inputs/rocm \
10// RUN:   %s \
11// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DEFAULT,GFX900-DEFAULT,GFX900,WAVE64 %s
12
13
14
15// Make sure the different denormal default is respected for gfx8
16// RUN: %clang -### -target amdgcn-amd-amdhsa \
17// RUN:   -x cl -mcpu=gfx803 \
18// RUN:   --rocm-path=%S/Inputs/rocm \
19// RUN:   %s \
20// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DEFAULT,GFX803-DEFAULT,GFX803,WAVE64 %s
21
22
23
24// Make sure the non-canonical name works
25// RUN: %clang -### -target amdgcn-amd-amdhsa \
26// RUN:   -x cl -mcpu=fiji \
27// RUN:   --rocm-path=%S/Inputs/rocm \
28// RUN:   %s \
29// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DEFAULT,GFX803-DEFAULT,GFX803,WAVE64 %s
30
31
32
33// RUN: %clang -### -target amdgcn-amd-amdhsa \
34// RUN:   -x cl -mcpu=gfx900 \
35// RUN:   -cl-denorms-are-zero \
36// RUN:   --rocm-path=%S/Inputs/rocm \
37// RUN:   %s \
38// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DAZ,GFX900,WAVE64 %s
39
40
41// RUN: %clang -### -target amdgcn-amd-amdhsa \
42// RUN:   -x cl -mcpu=gfx803 \
43// RUN:   -cl-denorms-are-zero \
44// RUN:   --rocm-path=%S/Inputs/rocm \
45// RUN:   %s \
46// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DAZ,GFX803,WAVE64 %s
47
48
49
50// RUN: %clang -### -target amdgcn-amd-amdhsa \
51// RUN:   -x cl -mcpu=gfx803 \
52// RUN:   -cl-finite-math-only \
53// RUN:   --rocm-path=%S/Inputs/rocm \
54// RUN:   %s \
55// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-FINITE-ONLY,GFX803,WAVE64 %s
56
57
58
59// RUN: %clang -### -target amdgcn-amd-amdhsa    \
60// RUN:   -x cl -mcpu=gfx803                     \
61// RUN:   -cl-fp32-correctly-rounded-divide-sqrt \
62// RUN:   --rocm-path=%S/Inputs/rocm \
63// RUN:   %s \
64// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-CORRECT-SQRT,GFX803,WAVE64 %s
65
66
67
68// RUN: %clang -### -target amdgcn-amd-amdhsa    \
69// RUN:   -x cl -mcpu=gfx803                     \
70// RUN:   -cl-fast-relaxed-math \
71// RUN:   --rocm-path=%S/Inputs/rocm \
72// RUN:   %s \
73// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-FAST-RELAXED,GFX803,WAVE64 %s
74
75
76
77// RUN: %clang -### -target amdgcn-amd-amdhsa    \
78// RUN:   -x cl -mcpu=gfx803                     \
79// RUN:   -cl-unsafe-math-optimizations \
80// RUN:   --rocm-path=%S/Inputs/rocm \
81// RUN:   %s \
82// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-UNSAFE,GFX803,WAVE64 %s
83
84// RUN: %clang -### -target amdgcn-amd-amdhsa    \
85// RUN:   -x cl -mcpu=gfx1010                    \
86// RUN:   --rocm-path=%S/Inputs/rocm \
87// RUN:   %s \
88// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE32 %s
89
90// RUN: %clang -### -target amdgcn-amd-amdhsa    \
91// RUN:   -x cl -mcpu=gfx1011                    \
92// RUN:   --rocm-path=%S/Inputs/rocm \
93// RUN:   %s \
94// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1011,WAVE32 %s
95
96// RUN: %clang -### -target amdgcn-amd-amdhsa    \
97// RUN:   -x cl -mcpu=gfx1012                    \
98// RUN:   --rocm-path=%S/Inputs/rocm \
99// RUN:   %s \
100// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1012,WAVE32 %s
101
102
103// RUN: %clang -### -target amdgcn-amd-amdhsa    \
104// RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64  \
105// RUN:   --rocm-path=%S/Inputs/rocm \
106// RUN:   %s \
107// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE64 %s
108
109// RUN: %clang -### -target amdgcn-amd-amdhsa    \
110// RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64 -mno-wavefrontsize64  \
111// RUN:   --rocm-path=%S/Inputs/rocm \
112// RUN:   %s \
113// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE32 %s
114
115// Ignore -mno-wavefrontsize64 without wave32 support
116// RUN: %clang -### -target amdgcn-amd-amdhsa       \
117// RUN:   -x cl -mcpu=gfx803  -mno-wavefrontsize64  \
118// RUN:   --rocm-path=%S/Inputs/rocm    \
119// RUN:   %s \
120// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX803,WAVE64 %s
121
122
123
124// Test --hip-device-lib-path format
125// RUN: %clang -### -target amdgcn-amd-amdhsa \
126// RUN:   -x cl -mcpu=gfx900 \
127// RUN:   --hip-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode \
128// RUN:   %S/opencl.cl \
129// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DEFAULT,GFX900-DEFAULT,GFX900,WAVE64 %s
130
131// Test environment variable HIP_DEVICE_LIB_PATH
132// RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/rocm/amdgcn/bitcode %clang -### -target amdgcn-amd-amdhsa \
133// RUN:   -x cl -mcpu=gfx900 \
134// RUN:   %S/opencl.cl \
135// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-DEFAULT,GFX900-DEFAULT,GFX900,WAVE64 %s
136
137
138
139// COMMON: "-triple" "amdgcn-amd-amdhsa"
140// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/opencl.bc"
141// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/ocml.bc"
142// COMMON-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/ockl.bc"
143
144// GFX900-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_off.bc"
145// GFX803-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_on.bc"
146// GFX700-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_on.bc"
147// COMMON-DAZ-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_daz_opt_on.bc"
148
149
150// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_off.bc"
151// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_off.bc"
152// COMMON-DEFAULT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc"
153
154
155// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_off.bc"
156// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_on.bc"
157// COMMON-FINITE-ONLY-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc"
158
159
160// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_off.bc"
161// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_off.bc"
162// COMMON-CORRECT-SQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc"
163
164
165// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_on.bc"
166// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_on.bc"
167// COMMON-FAST-RELAXED-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc"
168
169
170// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_unsafe_math_on.bc"
171// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_finite_only_off.bc"
172// COMMON-UNSAFE-MATH-SAME: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc"
173
174// WAVE64: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_wavefrontsize64_on.bc"
175// WAVE32: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_wavefrontsize64_off.bc"
176
177// GFX900: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_isa_version_900.bc"
178// GFX803: "-mlink-builtin-bitcode" "{{.*}}/amdgcn/bitcode/oclc_isa_version_803.bc"
179
180kernel void func(void);
181