1 // RUN
: %clang_cc1 -emit-llvm -o - -triple x86_64-darwin-apple %s | FileCheck %s
3 #pragma OPENCL EXTENSION cl_khr_fp16
: enable
5 // CHECK-LABEL
: define
{{.
*}} void
@test_half_builtins
6 void test_half_builtins
(half h0
, half h1
, half h2
, int i0
) {
9 // CHECK
: call half
@llvm.acos.f16
(half %h0
)
10 res
= __builtin_acosf16
(h0);
12 // CHECK
: call half
@llvm.asin.f16
(half %h0
)
13 res
= __builtin_asinf16
(h0);
15 // CHECK
: call half
@llvm.atan.f16
(half %h0
)
16 res
= __builtin_atanf16
(h0);
18 // CHECK
: call half
@llvm.atan2.f16
(half %h0
, half %h1
)
19 res
= __builtin_atan2f16
(h0, h1
);
21 // CHECK
: call half
@llvm.copysign.f16
(half %h0
, half %h1
)
22 res
= __builtin_copysignf16
(h0, h1
);
24 // CHECK
: call half
@llvm.fabs.f16
(half %h0
)
25 res
= __builtin_fabsf16
(h0);
27 // CHECK
: call half
@llvm.ceil.f16
(half %h0
)
28 res
= __builtin_ceilf16
(h0);
30 // CHECK
: call half
@llvm.cos.f16
(half %h0
)
31 res
= __builtin_cosf16
(h0);
33 // CHECK
: call half
@llvm.cosh.f16
(half %h0
)
34 res
= __builtin_coshf16
(h0);
36 // CHECK
: call half
@llvm.exp.f16
(half %h0
)
37 res
= __builtin_expf16
(h0);
39 // CHECK
: call half
@llvm.exp2.f16
(half %h0
)
40 res
= __builtin_exp2f16
(h0);
42 // CHECK
: call half
@llvm.exp10.f16
(half %h0
)
43 res
= __builtin_exp10f16
(h0);
45 // CHECK
: call half
@llvm.floor.f16
(half %h0
)
46 res
= __builtin_floorf16
(h0);
48 // CHECK
: call half
@llvm.fma.f16
(half %h0
, half %h1
, half %h2
)
49 res
= __builtin_fmaf16
(h0, h1
,h2
);
51 // CHECK
: call half
@llvm.maxnum.f16
(half %h0
, half %h1
)
52 res
= __builtin_fmaxf16
(h0, h1
);
54 // CHECK
: call half
@llvm.minnum.f16
(half %h0
, half %h1
)
55 res
= __builtin_fminf16
(h0, h1
);
57 // CHECK
: frem half %h0
, %h1
58 res
= __builtin_fmodf16
(h0, h1
);
60 // CHECK
: call half
@llvm.pow.f16
(half %h0
, half %h1
)
61 res
= __builtin_powf16
(h0, h1
);
63 // CHECK
: call half
@llvm.log10.f16
(half %h0
)
64 res
= __builtin_log10f16
(h0);
66 // CHECK
: call half
@llvm.log2.f16
(half %h0
)
67 res
= __builtin_log2f16
(h0);
69 // CHECK
: call half
@llvm.log.f16
(half %h0
)
70 res
= __builtin_logf16
(h0);
72 // CHECK
: call half
@llvm.rint.f16
(half %h0
)
73 res
= __builtin_rintf16
(h0);
75 // CHECK
: call half
@llvm.round.f16
(half %h0
)
76 res
= __builtin_roundf16
(h0);
78 // CHECK
: call half
@llvm.sin.f16
(half %h0
)
79 res
= __builtin_sinf16
(h0);
81 // CHECK
: call half
@llvm.sinh.f16
(half %h0
)
82 res
= __builtin_sinhf16
(h0);
84 // CHECK
: call half
@llvm.sqrt.f16
(half %h0
)
85 res
= __builtin_sqrtf16
(h0);
87 // CHECK
: call half
@llvm.tan.f16
(half %h0
)
88 res
= __builtin_tanf16
(h0);
90 // CHECK
: call half
@llvm.tanh.f16
(half %h0
)
91 res
= __builtin_tanhf16
(h0);
93 // CHECK
: call half
@llvm.trunc.f16
(half %h0
)
94 res
= __builtin_truncf16
(h0);
96 // CHECK
: call half
@llvm.canonicalize.f16
(half %h0
)
97 res
= __builtin_canonicalizef16
(h0);
99 // CHECK
: call half
@llvm.ldexp.f16.i32
(half %h0
, i32 %i0
)
100 res
= __builtin_ldexpf16
(h0, i0
);