xref: /llvm-project/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/tanh.ll (revision cf3d6fded9eaf1372ccfde1d49dd91df6762d98c)
1; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3
4; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450"
5; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32
6; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16
7; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4
8; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4
9
10define noundef float @tanh_float(float noundef %a) {
11entry:
12; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
13; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Tanh %[[#arg0]]
14  %elt.tanh = call float @llvm.tanh.f32(float %a)
15  ret float %elt.tanh
16}
17
18define noundef half @tanh_half(half noundef %a) {
19entry:
20; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
21; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Tanh %[[#arg0]]
22  %elt.tanh = call half @llvm.tanh.f16(half %a)
23  ret half %elt.tanh
24}
25
26define noundef <4 x float> @tanh_float4(<4 x float> noundef %a) {
27entry:
28  ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
29  ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Tanh %[[#arg0]]
30  %elt.tanh = call <4 x float> @llvm.tanh.v4f32(<4 x float> %a)
31  ret <4 x float> %elt.tanh
32}
33
34define noundef <4 x half> @tanh_half4(<4 x half> noundef %a) {
35entry:
36  ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
37  ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] Tanh %[[#arg0]]
38  %elt.tanh = call <4 x half> @llvm.tanh.v4f16(<4 x half> %a)
39  ret <4 x half> %elt.tanh
40}
41
42declare half @llvm.tanh.f16(half)
43declare float @llvm.tanh.f32(float)
44declare <4 x half> @llvm.tanh.v4f16(<4 x half>)
45declare <4 x float> @llvm.tanh.v4f32(<4 x float>)
46