xref: /llvm-project/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/radians.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
6; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32
7; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16
8
9; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4
10; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4
11
12declare half @llvm.spv.radians.f16(half)
13declare float @llvm.spv.radians.f32(float)
14
15declare <4 x float> @llvm.spv.radians.v4f32(<4 x float>)
16declare <4 x half> @llvm.spv.radians.v4f16(<4 x half>)
17
18define noundef float @radians_float(float noundef %a) {
19entry:
20; CHECK: %[[#float_32_arg:]] = OpFunctionParameter %[[#float_32]]
21; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Radians %[[#float_32_arg]]
22  %elt.radians = call float @llvm.spv.radians.f32(float %a)
23  ret float %elt.radians
24}
25
26define noundef half @radians_half(half noundef %a) {
27entry:
28; CHECK: %[[#float_16_arg:]] = OpFunctionParameter %[[#float_16]]
29; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Radians %[[#float_16_arg]]
30  %elt.radians = call half @llvm.spv.radians.f16(half %a)
31  ret half %elt.radians
32}
33
34define noundef <4 x float> @radians_float_vector(<4 x float> noundef %a) {
35entry:
36; CHECK: %[[#vec4_float_32_arg:]] = OpFunctionParameter %[[#vec4_float_32]]
37; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Radians %[[#vec4_float_32_arg]]
38  %elt.radians = call <4 x float> @llvm.spv.radians.v4f32(<4 x float> %a)
39  ret <4 x float> %elt.radians
40}
41
42define noundef <4 x half> @radians_half_vector(<4 x half> noundef %a) {
43entry:
44; CHECK: %[[#vec4_float_16_arg:]] = OpFunctionParameter %[[#vec4_float_16]]
45; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] Radians %[[#vec4_float_16_arg]]
46  %elt.radians = call <4 x half> @llvm.spv.radians.v4f16(<4 x half> %a)
47  ret <4 x half> %elt.radians
48}
49