diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-08-06 03:28:37 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-08-06 03:28:37 +0000 |
commit | 4981f502b05b69237cafe012e90f222736175bf2 (patch) | |
tree | 2795c57bf3d9b7675fe7dd9887510aebd1f0b5ab /test/CodeGenOpenCL | |
parent | 26d2be17f068e993a0213347c158022cb5ab28b7 (diff) |
Builtins: Start adding half versions of math builtins
The implementation of the OpenCL builtin currently library uses 2
different hacks to get to the corresponding IR intrinsics from the
source. This will allow removal of those.
This is the set that is currently used (minus a few vector ones).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367973 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenOpenCL')
-rw-r--r-- | test/CodeGenOpenCL/builtins-f16.cl | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/test/CodeGenOpenCL/builtins-f16.cl b/test/CodeGenOpenCL/builtins-f16.cl new file mode 100644 index 0000000000..4aef2c20b7 --- /dev/null +++ b/test/CodeGenOpenCL/builtins-f16.cl @@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-darwin-apple %s | FileCheck %s + +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +// CHECK-LABEL: define void @test_half_builtins +void test_half_builtins(half h0, half h1, half h2) { + volatile half res; + + // CHECK: call half @llvm.copysign.f16(half %h0, half %h1) + res = __builtin_copysignf16(h0, h1); + + // CHECK: call half @llvm.fabs.f16(half %h0) + res = __builtin_fabsf16(h0); + + // CHECK: call half @llvm.ceil.f16(half %h0) + res = __builtin_ceilf16(h0); + + // CHECK: call half @llvm.cos.f16(half %h0) + res = __builtin_cosf16(h0); + + // CHECK: call half @llvm.exp.f16(half %h0) + res = __builtin_expf16(h0); + + // CHECK: call half @llvm.exp2.f16(half %h0) + res = __builtin_exp2f16(h0); + + // CHECK: call half @llvm.floor.f16(half %h0) + res = __builtin_floorf16(h0); + + // CHECK: call half @llvm.fma.f16(half %h0, half %h1, half %h2) + res = __builtin_fmaf16(h0, h1 ,h2); + + // CHECK: call half @llvm.maxnum.f16(half %h0, half %h1) + res = __builtin_fmaxf16(h0, h1); + + // CHECK: call half @llvm.minnum.f16(half %h0, half %h1) + res = __builtin_fminf16(h0, h1); + + // CHECK: frem half %h0, %h1 + res = __builtin_fmodf16(h0, h1); + + // CHECK: call half @llvm.pow.f16(half %h0, half %h1) + res = __builtin_powf16(h0, h1); + + // CHECK: call half @llvm.log10.f16(half %h0) + res = __builtin_log10f16(h0); + + // CHECK: call half @llvm.log2.f16(half %h0) + res = __builtin_log2f16(h0); + + // CHECK: call half @llvm.log.f16(half %h0) + res = __builtin_logf16(h0); + + // CHECK: call half @llvm.rint.f16(half %h0) + res = __builtin_rintf16(h0); + + // CHECK: call half @llvm.round.f16(half %h0) + res = __builtin_roundf16(h0); + + // CHECK: call half @llvm.sin.f16(half %h0) + res = __builtin_sinf16(h0); + + // CHECK: call half @llvm.sqrt.f16(half %h0) + res = __builtin_sqrtf16(h0); + + // CHECK: call half @llvm.trunc.f16(half %h0) + res = __builtin_truncf16(h0); + + // CHECK: call half @llvm.canonicalize.f16(half %h0) + res = __builtin_canonicalizef16(h0); +} |