Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenOpenCL / builtins-generic-amdgcn.cl
blobb093fcbf7d9894d3b38478b8254589e10ee4b572
1 // REQUIRES: amdgpu-registered-target
2 // RUN: %clang_cc1 -Wno-error=int-conversion -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
4 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
6 // CHECK-LABEL: @test_builtin_clz(
7 // CHECK: tail call i32 @llvm.ctlz.i32(i32 %a, i1 true)
8 void test_builtin_clz(global int* out, int a)
10 *out = __builtin_clz(a);
13 // CHECK-LABEL: @test_builtin_clzl(
14 // CHECK: tail call i64 @llvm.ctlz.i64(i64 %a, i1 true)
15 void test_builtin_clzl(global long* out, long a)
17 *out = __builtin_clzl(a);
20 // CHECK: tail call ptr addrspace(5) @llvm.frameaddress.p5(i32 0)
21 void test_builtin_frame_address(int *out) {
22 *out = __builtin_frame_address(0);
25 // CHECK-LABEL: @test_builtin_ldexpf16(
26 // CHECK: tail call half @llvm.ldexp.f16.i32(half %v, i32 %e)
27 half test_builtin_ldexpf16(half v, int e) {
28 return __builtin_ldexpf16(v, e);
31 // CHECK-LABEL: @test_builtin_ldexpf(
32 // CHECK: tail call float @llvm.ldexp.f32.i32(float %v, i32 %e)
33 float test_builtin_ldexpf(float v, int e) {
34 return __builtin_ldexpf(v, e);
37 // CHECK-LABEL: @test_builtin_ldexp(
38 // CHECK: tail call double @llvm.ldexp.f64.i32(double %v, i32 %e)
39 double test_builtin_ldexp(double v, int e) {
40 return __builtin_ldexp(v, e);
43 // CHECK-LABEL: @test_builtin_frexpf16(
44 // CHECK: [[VAL:%.+]] = tail call { half, i32 } @llvm.frexp.f16.i32(half %v)
45 // CHECK: [[EXTRACT_1:%.+]] = extractvalue { half, i32 } [[VAL]], 1
46 // CHECK: store i32 [[EXTRACT_1]], ptr addrspace(5)
47 // CHECK: [[EXTRACT_0:%.+]] = extractvalue { half, i32 } [[VAL]], 0
48 // CHECK: ret half [[EXTRACT_0]]
49 half test_builtin_frexpf16(half v, int* e) {
50 return __builtin_frexpf16(v, e);
53 // CHECK-LABEL: @test_builtin_frexpf(
54 // CHECK: [[VAL:%.+]] = tail call { float, i32 } @llvm.frexp.f32.i32(float %v)
55 // CHECK: [[EXTRACT_1:%.+]] = extractvalue { float, i32 } [[VAL]], 1
56 // CHECK: store i32 [[EXTRACT_1]], ptr addrspace(5)
57 // CHECK: [[EXTRACT_0:%.+]] = extractvalue { float, i32 } [[VAL]], 0
58 // CHECK: ret float [[EXTRACT_0]]
59 float test_builtin_frexpf(float v, int* e) {
60 return __builtin_frexpf(v, e);
63 // CHECK-LABEL: @test_builtin_frexp(
64 // CHECK: [[VAL:%.+]] = tail call { double, i32 } @llvm.frexp.f64.i32(double %v)
65 // CHECK: [[EXTRACT_1:%.+]] = extractvalue { double, i32 } [[VAL]], 1
66 // CHECK: store i32 [[EXTRACT_1]], ptr addrspace(5)
67 // CHECK: [[EXTRACT_0:%.+]] = extractvalue { double, i32 } [[VAL]], 0
68 // CHECK: ret double [[EXTRACT_0]]
69 double test_builtin_frexp(double v, int* e) {
70 return __builtin_frexp(v, e);