|
| 1 | +; RUN: llc -verify-machineinstrs -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 @atan2_float(float noundef %a, float noundef %b) { |
| 11 | +entry: |
| 12 | +; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] |
| 13 | +; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]] |
| 14 | +; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Atan2 %[[#arg0]] %[[#arg1]] |
| 15 | + %elt.atan2 = call float @llvm.atan2.f32(float %a, float %b) |
| 16 | + ret float %elt.atan2 |
| 17 | +} |
| 18 | + |
| 19 | +define noundef half @atan2_half(half noundef %a, half noundef %b) { |
| 20 | +entry: |
| 21 | +; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] |
| 22 | +; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]] |
| 23 | +; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Atan2 %[[#arg0]] %[[#arg1]] |
| 24 | + %elt.atan2 = call half @llvm.atan2.f16(half %a, half %b) |
| 25 | + ret half %elt.atan2 |
| 26 | +} |
| 27 | + |
| 28 | +define noundef <4 x float> @atan2_float4(<4 x float> noundef %a, <4 x float> noundef %b) { |
| 29 | +entry: |
| 30 | + ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] |
| 31 | + ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]] |
| 32 | + ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Atan2 %[[#arg0]] %[[#arg1]] |
| 33 | + %elt.atan2 = call <4 x float> @llvm.atan2.v4f32(<4 x float> %a, <4 x float> %b) |
| 34 | + ret <4 x float> %elt.atan2 |
| 35 | +} |
| 36 | + |
| 37 | +define noundef <4 x half> @atan2_half4(<4 x half> noundef %a, <4 x half> noundef %b) { |
| 38 | +entry: |
| 39 | + ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] |
| 40 | + ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]] |
| 41 | + ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] Atan2 %[[#arg0]] %[[#arg1]] |
| 42 | + %elt.atan2 = call <4 x half> @llvm.atan2.v4f16(<4 x half> %a, <4 x half> %b) |
| 43 | + ret <4 x half> %elt.atan2 |
| 44 | +} |
| 45 | + |
| 46 | +declare half @llvm.atan2.f16(half, half) |
| 47 | +declare float @llvm.atan2.f32(float, float) |
| 48 | +declare <4 x half> @llvm.atan2.v4f16(<4 x half>, <4 x half>) |
| 49 | +declare <4 x float> @llvm.atan2.v4f32(<4 x float>, <4 x float>) |
0 commit comments