| 1 |
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s |
| 2 |
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s |
| 3 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %} |
| 4 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %} |
| 5 |
|
| 6 |
; CHECK-DAG: %[[#op_ext_ocl:]] = OpExtInstImport "OpenCL.std" |
| 7 |
|
| 8 |
; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32 |
| 9 |
; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16 |
| 10 |
|
| 11 |
; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4 |
| 12 |
; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4 |
| 13 |
|
| 14 |
declare half @llvm.spv.degrees.f16(half) |
| 15 |
declare float @llvm.spv.degrees.f32(float) |
| 16 |
|
| 17 |
declare <4 x float> @llvm.spv.degrees.v4f32(<4 x float>) |
| 18 |
declare <4 x half> @llvm.spv.degrees.v4f16(<4 x half>) |
| 19 |
|
| 20 |
define noundef float @degrees_float(float noundef %a) { |
| 21 |
entry: |
| 22 |
; CHECK: %[[#float_32_arg:]] = OpFunctionParameter %[[#float_32]] |
| 23 |
; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_ocl]] degrees %[[#float_32_arg]] |
| 24 |
%elt.degrees = call float @llvm.spv.degrees.f32(float %a) |
| 25 |
ret float %elt.degrees |
| 26 |
} |
| 27 |
|
| 28 |
define noundef half @degrees_half(half noundef %a) { |
| 29 |
entry: |
| 30 |
; CHECK: %[[#float_16_arg:]] = OpFunctionParameter %[[#float_16]] |
| 31 |
; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_ocl]] degrees %[[#float_16_arg]] |
| 32 |
%elt.degrees = call half @llvm.spv.degrees.f16(half %a) |
| 33 |
ret half %elt.degrees |
| 34 |
} |
| 35 |
|
| 36 |
define noundef <4 x float> @degrees_float_vector(<4 x float> noundef %a) { |
| 37 |
entry: |
| 38 |
; CHECK: %[[#vec4_float_32_arg:]] = OpFunctionParameter %[[#vec4_float_32]] |
| 39 |
; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_ocl]] degrees %[[#vec4_float_32_arg]] |
| 40 |
%elt.degrees = call <4 x float> @llvm.spv.degrees.v4f32(<4 x float> %a) |
| 41 |
ret <4 x float> %elt.degrees |
| 42 |
} |
| 43 |
|
| 44 |
define noundef <4 x half> @degrees_half_vector(<4 x half> noundef %a) { |
| 45 |
entry: |
| 46 |
; CHECK: %[[#vec4_float_16_arg:]] = OpFunctionParameter %[[#vec4_float_16]] |
| 47 |
; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_ocl]] degrees %[[#vec4_float_16_arg]] |
| 48 |
%elt.degrees = call <4 x half> @llvm.spv.degrees.v4f16(<4 x half> %a) |
| 49 |
ret <4 x half> %elt.degrees |
| 50 |
} |