|
| 1 | +; RUN: llc -O0 -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 | + |
| 10 | +define noundef float @tan_float(float noundef %a) { |
| 11 | +entry: |
| 12 | +; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] |
| 13 | +; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Tan %[[#arg0]] |
| 14 | + %elt.tan = call float @llvm.tan.f32(float %a) |
| 15 | + ret float %elt.tan |
| 16 | +} |
| 17 | + |
| 18 | +define noundef half @tan_half(half noundef %a) { |
| 19 | +entry: |
| 20 | +; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] |
| 21 | +; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Tan %[[#arg0]] |
| 22 | + %elt.tan = call half @llvm.tan.f16(half %a) |
| 23 | + ret half %elt.tan |
| 24 | +} |
| 25 | + |
| 26 | +define noundef <4 x float> @tan_float4(<4 x float> noundef %a) { |
| 27 | +entry: |
| 28 | + ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] |
| 29 | + ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Tan %[[#arg0]] |
| 30 | + %elt.tan = call <4 x float> @llvm.tan.v4f32(<4 x float> %a) |
| 31 | + ret <4 x float> %elt.tan |
| 32 | +} |
| 33 | + |
| 34 | +define noundef <4 x half> @tan_half4(<4 x half> noundef %a) { |
| 35 | +entry: |
| 36 | + ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] |
| 37 | + ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] Tan %[[#arg0]] |
| 38 | + %elt.tan = call <4 x half> @llvm.tan.v4f16(<4 x half> %a) |
| 39 | + ret <4 x half> %elt.tan |
| 40 | +} |
| 41 | + |
| 42 | +declare half @llvm.tan.f16(half) |
| 43 | +declare float @llvm.tan.f32(float) |
| 44 | +declare <4 x half> @llvm.tan.v4f16(<4 x half>) |
| 45 | +declare <4 x float> @llvm.tan.v4f32(<4 x float>) |
0 commit comments