1 // REQUIRES
: r600-registered-target
2 // RUN
: %clang_cc1 -triple r600-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
3 // RUN
: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
5 #pragma OPENCL EXTENSION cl_khr_fp64
: enable
7 // CHECK-LABEL
: @test_div_scale_f64
8 // CHECK
: call
{ double
, i1
} @llvm.AMDGPU.div.scale.f64
(double %a
, double %b
, i1 true
)
9 // CHECK-DAG
: [[FLAG
:%.
+]] = extractvalue
{ double
, i1
} %
{{.
+}}, 1
10 // CHECK-DAG
: [[VAL
:%.
+]] = extractvalue
{ double
, i1
} %
{{.
+}}, 0
11 // CHECK
: [[FLAGEXT
:%.
+]] = zext i1
[[FLAG]] to i32
12 // CHECK: store i32 [[FLAGEXT]]
13 void test_div_scale_f64(global double* out, global int* flagout, double a, double b)
16 *out = __builtin_amdgpu_div_scale(a, b, true, &flag);
20 // CHECK-LABEL: @test_div_scale_f32
21 // CHECK: call { float, i1 } @llvm.AMDGPU.div.scale.f32(float %a, float %b, i1 true)
22 // CHECK-DAG: [[FLAG:%.+]] = extractvalue { float, i1 } %{{.+}}, 1
23 // CHECK-DAG: [[VAL:%.+]] = extractvalue { float, i1 } %{{.+}}, 0
24 // CHECK: [[FLAGEXT:%.+]] = zext i1 [[FLAG]] to i32
25 // CHECK
: store i32
[[FLAGEXT]]
26 void test_div_scale_f32(global float* out, global int* flagout, float a, float b)
29 *out = __builtin_amdgpu_div_scalef(a, b, true, &flag);
33 // CHECK-LABEL: @test_div_fmas_f32
34 // CHECK: call float @llvm.AMDGPU.div.fmas.f32
35 void test_div_fmas_f32(global float* out, float a, float b, float c, int d)
37 *out = __builtin_amdgpu_div_fmasf(a, b, c, d);
40 // CHECK-LABEL: @test_div_fmas_f64
41 // CHECK: call double @llvm.AMDGPU.div.fmas.f64
42 void test_div_fmas_f64(global double* out, double a, double b, double c, int d)
44 *out = __builtin_amdgpu_div_fmas(a, b, c, d);
47 // CHECK-LABEL: @test_div_fixup_f32
48 // CHECK: call float @llvm.AMDGPU.div.fixup.f32
49 void test_div_fixup_f32(global float* out, float a, float b, float c)
51 *out = __builtin_amdgpu_div_fixupf(a, b, c);
54 // CHECK-LABEL: @test_div_fixup_f64
55 // CHECK: call double @llvm.AMDGPU.div.fixup.f64
56 void test_div_fixup_f64(global double* out, double a, double b, double c)
58 *out = __builtin_amdgpu_div_fixup(a, b, c);
61 // CHECK-LABEL: @test_trig_preop_f32
62 // CHECK: call float @llvm.AMDGPU.trig.preop.f32
63 void test_trig_preop_f32(global float* out, float a, int b)
65 *out = __builtin_amdgpu_trig_preopf(a, b);
68 // CHECK-LABEL: @test_trig_preop_f64
69 // CHECK: call double @llvm.AMDGPU.trig.preop.f64
70 void test_trig_preop_f64(global double* out, double a, int b)
72 *out = __builtin_amdgpu_trig_preop(a, b);
75 // CHECK-LABEL: @test_rcp_f32
76 // CHECK: call float @llvm.AMDGPU.rcp.f32
77 void test_rcp_f32(global float* out, float a)
79 *out = __builtin_amdgpu_rcpf(a);
82 // CHECK-LABEL: @test_rcp_f64
83 // CHECK: call double @llvm.AMDGPU.rcp.f64
84 void test_rcp_f64(global double* out, double a)
86 *out = __builtin_amdgpu_rcp(a);
89 // CHECK-LABEL: @test_rsq_f32
90 // CHECK: call float @llvm.AMDGPU.rsq.f32
91 void test_rsq_f32(global float* out, float a)
93 *out = __builtin_amdgpu_rsqf(a);
96 // CHECK-LABEL: @test_rsq_f64
97 // CHECK: call double @llvm.AMDGPU.rsq.f64
98 void test_rsq_f64(global double* out, double a)
100 *out = __builtin_amdgpu_rsq(a);
103 // CHECK-LABEL: @test_rsq_clamped_f32
104 // CHECK: call float @llvm.AMDGPU.rsq.clamped.f32
105 void test_rsq_clamped_f32(global float* out, float a)
107 *out = __builtin_amdgpu_rsq_clampedf(a);
110 // CHECK-LABEL: @test_rsq_clamped_f64
111 // CHECK: call double @llvm.AMDGPU.rsq.clamped.f64
112 void test_rsq_clamped_f64(global double* out, double a)
114 *out = __builtin_amdgpu_rsq_clamped(a);
117 // CHECK-LABEL: @test_ldexp_f32
118 // CHECK: call float @llvm.AMDGPU.ldexp.f32
119 void test_ldexp_f32(global float* out, float a, int b)
121 *out = __builtin_amdgpu_ldexpf(a, b);
124 // CHECK-LABEL: @test_ldexp_f64
125 // CHECK: call double @llvm.AMDGPU.ldexp.f64
126 void test_ldexp_f64(global double* out, double a, int b)
128 *out = __builtin_amdgpu_ldexp(a, b);
131 // CHECK-LABEL: @test_class_f32
132 // CHECK: call i1 @llvm.AMDGPU.class.f32
133 void test_class_f32(global float* out, float a, int b)
135 *out = __builtin_amdgpu_classf(a, b);
138 // CHECK-LABEL: @test_class_f64
139 // CHECK: call i1 @llvm.AMDGPU.class.f64
140 void test_class_f64(global double* out, double a, int b)
142 *out = __builtin_amdgpu_class(a, b);