2016-06-08 09:56:42 +08:00
|
|
|
// REQUIRES: amdgpu-registered-target
|
|
|
|
// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu tonga -S -emit-llvm -o - %s | FileCheck %s
|
|
|
|
|
2016-11-13 10:37:05 +08:00
|
|
|
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
|
|
|
|
|
2016-06-08 09:56:42 +08:00
|
|
|
typedef unsigned long ulong;
|
|
|
|
|
2016-11-13 10:37:05 +08:00
|
|
|
// CHECK-LABEL: @test_div_fixup_f16
|
|
|
|
// CHECK: call half @llvm.amdgcn.div.fixup.f16
|
|
|
|
void test_div_fixup_f16(global half* out, half a, half b, half c)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_div_fixuph(a, b, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_rcp_f16
|
|
|
|
// CHECK: call half @llvm.amdgcn.rcp.f16
|
|
|
|
void test_rcp_f16(global half* out, half a)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_rcph(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_rsq_f16
|
|
|
|
// CHECK: call half @llvm.amdgcn.rsq.f16
|
|
|
|
void test_rsq_f16(global half* out, half a)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_rsqh(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_sin_f16
|
|
|
|
// CHECK: call half @llvm.amdgcn.sin.f16
|
|
|
|
void test_sin_f16(global half* out, half a)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_sinh(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_cos_f16
|
|
|
|
// CHECK: call half @llvm.amdgcn.cos.f16
|
|
|
|
void test_cos_f16(global half* out, half a)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_cosh(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_ldexp_f16
|
|
|
|
// CHECK: call half @llvm.amdgcn.ldexp.f16
|
|
|
|
void test_ldexp_f16(global half* out, half a, int b)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_ldexph(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_frexp_mant_f16
|
|
|
|
// CHECK: call half @llvm.amdgcn.frexp.mant.f16
|
|
|
|
void test_frexp_mant_f16(global half* out, half a)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_frexp_manth(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_frexp_exp_f16
|
2016-11-19 06:31:51 +08:00
|
|
|
// CHECK: call i16 @llvm.amdgcn.frexp.exp.i16.f16
|
2016-11-13 10:37:05 +08:00
|
|
|
void test_frexp_exp_f16(global short* out, half a)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_frexp_exph(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_fract_f16
|
|
|
|
// CHECK: call half @llvm.amdgcn.fract.f16
|
|
|
|
void test_fract_f16(global half* out, half a)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_fracth(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_class_f16
|
|
|
|
// CHECK: call i1 @llvm.amdgcn.class.f16
|
|
|
|
void test_class_f16(global half* out, half a, int b)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_classh(a, b);
|
|
|
|
}
|
2016-06-08 09:56:42 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: @test_s_memrealtime
|
|
|
|
// CHECK: call i64 @llvm.amdgcn.s.memrealtime()
|
|
|
|
void test_s_memrealtime(global ulong* out)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_s_memrealtime();
|
|
|
|
}
|
2017-03-10 09:30:46 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: @test_mov_dpp
|
|
|
|
// CHECK: call i32 @llvm.amdgcn.mov.dpp.i32(i32 %src, i32 0, i32 0, i32 0, i1 false)
|
|
|
|
void test_mov_dpp(global int* out, int src)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_mov_dpp(src, 0, 0, 0, false);
|
|
|
|
}
|
|
|
|
|