[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / CodeGenOpenCL / amdgpu-ieee.cl
blob0a7b0d4f494ef91bcadd79823d543a1de6244345
1 // REQUIRES: amdgpu-registered-target
2 //
3 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -O0 -emit-llvm -o - %s \
4 // RUN: | FileCheck -check-prefixes=COMMON,ON %s
5 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -O0 -emit-llvm -o - %s \
6 // RUN: -mno-amdgpu-ieee -menable-no-nans \
7 // RUN: | FileCheck -check-prefixes=COMMON,OFF %s
8 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -O0 -emit-llvm -o - %s \
9 // RUN: -mno-amdgpu-ieee -cl-fast-relaxed-math \
10 // RUN: | FileCheck -check-prefixes=COMMON,OFF %s
12 // Check AMDGCN ISA generation.
14 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -O3 -S -o - %s \
15 // RUN: | FileCheck -check-prefixes=ISA-ON %s
16 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -O3 -S -o - %s \
17 // RUN: -mno-amdgpu-ieee -menable-no-nans \
18 // RUN: | FileCheck -check-prefixes=ISA-OFF %s
20 // Check diagnostics when using -mno-amdgpu-ieee without NoHonorNaNs.
22 // RUN: not %clang_cc1 -triple amdgcn-amd-amdhsa -O0 -emit-llvm -o - %s \
23 // RUN: -mno-amdgpu-ieee 2>&1 | FileCheck -check-prefixes=DIAG %s
25 // COMMON: define{{.*}} amdgpu_kernel void @kern{{.*}} [[ATTRS1:#[0-9]+]]
26 // ISA-ON: v_mul_f32_e64 v{{[0-9]+}}, 1.0, s{{[0-9]+}}
27 // ISA-ON: v_mul_f32_e64 v{{[0-9]+}}, 1.0, s{{[0-9]+}}
28 // ISA-ON: v_min_f32_e32
29 // ISA-ON: ; IeeeMode: 1
30 // ISA-OFF-NOT: v_mul_f32_e64 v{{[0-9]+}}, 1.0, s{{[0-9]+}}
31 // ISA-OFF-NOT: v_mul_f32_e64 v{{[0-9]+}}, 1.0, s{{[0-9]+}}
32 // ISA-OFF: v_min_f32_e32
33 // ISA-OFF: ; IeeeMode: 0
34 kernel void kern(global float *x, float y, float z) {
35 *x = __builtin_fmin(y, z);
38 // COMMON: define{{.*}}void @fun() [[ATTRS2:#[0-9]+]]
39 void fun() {
42 // ON-NOT: attributes [[ATTRS1]] = {{.*}} "amdgpu-ieee"
43 // OFF: attributes [[ATTRS1]] = {{.*}} "amdgpu-ieee"="false"{{.*}}"no-nans-fp-math"="true"{{.*}}"no-trapping-math"="true"
44 // ON-NOT: attributes [[ATTRS2]] = {{.*}} "amdgpu-ieee"
45 // OFF: attributes [[ATTRS2]] = {{.*}} "amdgpu-ieee"="false"{{.*}}"no-nans-fp-math"="true"{{.*}}"no-trapping-math"="true"
47 // DIAG: invalid argument '-mno-amdgpu-ieee' only allowed with relaxed NaN handling