150
|
1 // REQUIRES: clang-driver
|
|
2 // REQUIRES: x86-registered-target
|
|
3 // REQUIRES: amdgpu-registered-target
|
|
4
|
173
|
5 // Test if oclc_daz_opt_on or if oclc_daz_opt_off is linked depending on
|
|
6 // expected denormal mode.
|
|
7
|
|
8 // Test subtarget with flushing on by default.
|
|
9 // RUN: %clang -### -target x86_64-linux-gnu \
|
|
10 // RUN: --cuda-gpu-arch=gfx803 \
|
221
|
11 // RUN: --rocm-path=%S/Inputs/rocm \
|
173
|
12 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
13 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD
|
|
14
|
150
|
15
|
173
|
16 // Test subtarget with flushing off by ddefault.
|
|
17 // RUN: %clang -### -target x86_64-linux-gnu \
|
|
18 // RUN: --cuda-gpu-arch=gfx900 \
|
221
|
19 // RUN: --rocm-path=%S/Inputs/rocm \
|
173
|
20 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
21 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD
|
|
22
|
|
23
|
|
24 // Test explicit flag, opposite of target default.
|
|
25 // RUN: %clang -### -target x86_64-linux-gnu \
|
|
26 // RUN: --cuda-gpu-arch=gfx900 \
|
221
|
27 // RUN: -fgpu-flush-denormals-to-zero \
|
|
28 // RUN: --rocm-path=%S/Inputs/rocm \
|
173
|
29 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
30 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD
|
|
31
|
|
32
|
|
33 // Test explicit flag, opposite of target default.
|
150
|
34 // RUN: %clang -### -target x86_64-linux-gnu \
|
173
|
35 // RUN: --cuda-gpu-arch=gfx803 \
|
221
|
36 // RUN: -fno-gpu-flush-denormals-to-zero \
|
|
37 // RUN: --rocm-path=%S/Inputs/rocm \
|
173
|
38 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
39 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD
|
|
40
|
|
41
|
|
42 // Test explicit flag, same as target default.
|
|
43 // RUN: %clang -### -target x86_64-linux-gnu \
|
|
44 // RUN: --cuda-gpu-arch=gfx900 \
|
221
|
45 // RUN: -fno-gpu-flush-denormals-to-zero \
|
|
46 // RUN: --rocm-path=%S/Inputs/rocm \
|
150
|
47 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
173
|
48 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD
|
|
49
|
150
|
50
|
173
|
51 // Test explicit flag, same as target default.
|
|
52 // RUN: %clang -### -target x86_64-linux-gnu \
|
|
53 // RUN: --cuda-gpu-arch=gfx803 \
|
221
|
54 // RUN: -fgpu-flush-denormals-to-zero \
|
|
55 // RUN: --rocm-path=%S/Inputs/rocm \
|
173
|
56 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
57 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD
|
|
58
|
|
59
|
|
60 // Test last flag wins, not flushing
|
|
61 // RUN: %clang -### -target x86_64-linux-gnu \
|
|
62 // RUN: --cuda-gpu-arch=gfx803 \
|
221
|
63 // RUN: -fgpu-flush-denormals-to-zero -fno-gpu-flush-denormals-to-zero \
|
|
64 // RUN: --rocm-path=%S/Inputs/rocm \
|
173
|
65 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
66 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD
|
|
67
|
150
|
68
|
|
69 // RUN: %clang -### -target x86_64-linux-gnu \
|
173
|
70 // RUN: --cuda-gpu-arch=gfx900 \
|
221
|
71 // RUN: -fgpu-flush-denormals-to-zero -fno-gpu-flush-denormals-to-zero \
|
|
72 // RUN: --rocm-path=%S/Inputs/rocm \
|
173
|
73 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
74 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD
|
|
75
|
|
76
|
|
77 // RUN: %clang -### -target x86_64-linux-gnu \
|
|
78 // RUN: --cuda-gpu-arch=gfx900 \
|
221
|
79 // RUN: -fno-gpu-flush-denormals-to-zero -fgpu-flush-denormals-to-zero \
|
|
80 // RUN: --rocm-path=%S/Inputs/rocm \
|
150
|
81 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
173
|
82 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD
|
|
83
|
|
84
|
|
85 // RUN: %clang -### -target x86_64-linux-gnu \
|
|
86 // RUN: --cuda-gpu-arch=gfx803 \
|
221
|
87 // RUN: -fno-gpu-flush-denormals-to-zero -fgpu-flush-denormals-to-zero \
|
|
88 // RUN: --rocm-path=%S/Inputs/rocm \
|
173
|
89 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
90 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD
|
|
91
|
|
92
|
|
93 // Test --hip-device-lib-path flag
|
|
94 // RUN: %clang -### -target x86_64-linux-gnu \
|
221
|
95 // RUN: --cuda-gpu-arch=gfx803 -nogpuinc \
|
|
96 // RUN: --hip-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode \
|
173
|
97 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
98 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD
|
|
99
|
150
|
100
|
|
101 // Test environment variable HIP_DEVICE_LIB_PATH
|
221
|
102 // RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/rocm/amdgcn/bitcode \
|
150
|
103 // RUN: %clang -### -target x86_64-linux-gnu \
|
221
|
104 // RUN: --cuda-gpu-arch=gfx900 -nogpuinc \
|
150
|
105 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
173
|
106 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL
|
150
|
107
|
221
|
108 // Test --gpu-instrument-lib
|
|
109 // RUN: %clang -### -target x86_64-linux-gnu \
|
|
110 // RUN: --cuda-gpu-arch=gfx900 \
|
|
111 // RUN: --rocm-path=%S/Inputs/rocm \
|
|
112 // RUN: --gpu-instrument-lib=%S/Inputs/hip_multiple_inputs/instrument.bc \
|
|
113 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
114 // RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,INST
|
|
115
|
|
116 // Test -fast-math
|
|
117 // RUN: %clang -### -target x86_64-linux-gnu --offload-arch=gfx900 \
|
|
118 // RUN: -ffast-math --rocm-path=%S/Inputs/rocm \
|
|
119 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
120 // RUN: 2>&1 | FileCheck %s --check-prefixes=FAST
|
|
121
|
|
122 // Test -ffinite-math-only
|
|
123 // RUN: %clang -### -target x86_64-linux-gnu --offload-arch=gfx900 \
|
|
124 // RUN: -ffinite-math-only --rocm-path=%S/Inputs/rocm \
|
|
125 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
126 // RUN: 2>&1 | FileCheck %s --check-prefixes=FINITE
|
|
127
|
|
128 // Test -funsafe-math-optimizations
|
|
129 // RUN: %clang -### -target x86_64-linux-gnu --offload-arch=gfx900 \
|
|
130 // RUN: -funsafe-math-optimizations --rocm-path=%S/Inputs/rocm \
|
|
131 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
132 // RUN: 2>&1 | FileCheck %s --check-prefixes=UNSAFE
|
|
133
|
|
134 // Test -fno-hip-fp32-correctly-rounded-divide-sqrt
|
|
135 // RUN: %clang -### -target x86_64-linux-gnu --offload-arch=gfx900 \
|
|
136 // RUN: -fno-hip-fp32-correctly-rounded-divide-sqrt \
|
|
137 // RUN: --rocm-path=%S/Inputs/rocm %S/Inputs/hip_multiple_inputs/b.hip \
|
|
138 // RUN: 2>&1 | FileCheck %s --check-prefixes=DIVSQRT
|
|
139
|
|
140 // ALL-NOT: error:
|
173
|
141 // ALL: {{"[^"]*clang[^"]*"}}
|
|
142 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}hip.bc"
|
|
143 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}ocml.bc"
|
|
144 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}ockl.bc"
|
150
|
145
|
173
|
146 // FLUSHD-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_daz_opt_on.bc"
|
|
147 // NOFLUSHD-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_daz_opt_off.bc"
|
|
148
|
|
149 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_unsafe_math_off.bc"
|
|
150 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_finite_only_off.bc"
|
|
151 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_correctly_rounded_sqrt_on.bc"
|
|
152 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_wavefrontsize64_on.bc"
|
|
153 // ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_isa_version_{{[0-9]+}}.bc"
|
221
|
154 // INST-SAME: "-mlink-builtin-bitcode" "{{.*}}instrument.bc"
|
|
155
|
|
156 // FAST: "-mlink-builtin-bitcode" "{{.*}}oclc_daz_opt_off.bc"
|
|
157 // FAST-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_unsafe_math_on.bc"
|
|
158 // FAST-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_finite_only_on.bc"
|
|
159 // FAST-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_correctly_rounded_sqrt_on.bc"
|
|
160
|
|
161 // FINITE: "-mlink-builtin-bitcode" "{{.*}}oclc_daz_opt_off.bc"
|
|
162 // FINITE-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_unsafe_math_off.bc"
|
|
163 // FINITE-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_finite_only_on.bc"
|
|
164 // FINITE-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_correctly_rounded_sqrt_on.bc"
|
|
165
|
|
166 // UNSAFE: "-mlink-builtin-bitcode" "{{.*}}oclc_daz_opt_off.bc"
|
|
167 // UNSAFE-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_unsafe_math_on.bc"
|
|
168 // UNSAFE-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_finite_only_off.bc"
|
|
169 // UNSAFE-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_correctly_rounded_sqrt_on.bc"
|
|
170
|
|
171 // DIVSQRT: "-mlink-builtin-bitcode" "{{.*}}oclc_daz_opt_off.bc"
|
|
172 // DIVSQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_unsafe_math_off.bc"
|
|
173 // DIVSQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_finite_only_off.bc"
|
|
174 // DIVSQRT-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_correctly_rounded_sqrt_off.bc"
|