| 1 |
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_INTEL_function_pointers %s -o - | FileCheck %s |
| 2 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %} |
| 3 |
|
| 4 |
target triple = "spir64-unknown-unknown" |
| 5 |
|
| 6 |
; CHECK-DAG: %[[Half:.*]] = OpTypeFloat 16 |
| 7 |
; CHECK-DAG: %[[HalfVec2:.*]] = OpTypeVector %[[Half]] 2 |
| 8 |
; CHECK-DAG: %[[HalfVec3:.*]] = OpTypeVector %[[Half]] 3 |
| 9 |
|
| 10 |
; CHECK-DAG: %[[Float:.*]] = OpTypeFloat 32 |
| 11 |
; CHECK-DAG: %[[FloatVec2:.*]] = OpTypeVector %[[Float]] 2 |
| 12 |
; CHECK-DAG: %[[FloatVec3:.*]] = OpTypeVector %[[Float]] 3 |
| 13 |
|
| 14 |
; CHECK-DAG: %[[Double:.*]] = OpTypeFloat 64 |
| 15 |
; CHECK-DAG: %[[DoubleVec2:.*]] = OpTypeVector %[[Double]] 2 |
| 16 |
; CHECK-DAG: %[[DoubleVec3:.*]] = OpTypeVector %[[Double]] 3 |
| 17 |
|
| 18 |
; CHECK: OpFunction |
| 19 |
; CHECK: %[[ParamVec2Half:.*]] = OpFunctionParameter %[[HalfVec2]] |
| 20 |
; CHECK: %[[Vec2HalfItem0:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec2Half]] 0 |
| 21 |
; CHECK: %[[Vec2HalfItem1:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec2Half]] 1 |
| 22 |
; CHECK: %[[Vec2HalfR1:.*]] = OpExtInst %[[Half]] %[[#]] fmin %[[Vec2HalfItem0]] %[[Vec2HalfItem1]] |
| 23 |
; CHECK: OpReturnValue %[[Vec2HalfR1]] |
| 24 |
; CHECK: OpFunctionEnd |
| 25 |
|
| 26 |
; CHECK: OpFunction |
| 27 |
; CHECK: %[[ParamVec3Half:.*]] = OpFunctionParameter %[[HalfVec3]] |
| 28 |
; CHECK: %[[Vec3HalfItem0:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec3Half]] 0 |
| 29 |
; CHECK: %[[Vec3HalfItem1:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec3Half]] 1 |
| 30 |
; CHECK: %[[Vec3HalfItem2:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec3Half]] 2 |
| 31 |
; CHECK: %[[Vec3HalfR1:.*]] = OpExtInst %[[Half]] %[[#]] fmin %[[Vec3HalfItem0]] %[[Vec3HalfItem1]] |
| 32 |
; CHECK: %[[Vec3HalfR2:.*]] = OpExtInst %[[Half]] %[[#]] fmin %[[Vec3HalfR1]] %[[Vec3HalfItem2]] |
| 33 |
; CHECK: OpReturnValue %[[Vec3HalfR2]] |
| 34 |
; CHECK: OpFunctionEnd |
| 35 |
|
| 36 |
; CHECK: OpFunction |
| 37 |
; CHECK: %[[ParamVec2Float:.*]] = OpFunctionParameter %[[FloatVec2]] |
| 38 |
; CHECK: %[[Vec2FloatItem0:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec2Float]] 0 |
| 39 |
; CHECK: %[[Vec2FloatItem1:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec2Float]] 1 |
| 40 |
; CHECK: %[[Vec2FloatR1:.*]] = OpExtInst %[[Float]] %[[#]] fmin %[[Vec2FloatItem0]] %[[Vec2FloatItem1]] |
| 41 |
; CHECK: OpReturnValue %[[Vec2FloatR1]] |
| 42 |
; CHECK: OpFunctionEnd |
| 43 |
|
| 44 |
; CHECK: OpFunction |
| 45 |
; CHECK: %[[ParamVec3Float:.*]] = OpFunctionParameter %[[FloatVec3]] |
| 46 |
; CHECK: %[[Vec3FloatItem0:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec3Float]] 0 |
| 47 |
; CHECK: %[[Vec3FloatItem1:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec3Float]] 1 |
| 48 |
; CHECK: %[[Vec3FloatItem2:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec3Float]] 2 |
| 49 |
; CHECK: %[[Vec3FloatR1:.*]] = OpExtInst %[[Float]] %[[#]] fmin %[[Vec3FloatItem0]] %[[Vec3FloatItem1]] |
| 50 |
; CHECK: %[[Vec3FloatR2:.*]] = OpExtInst %[[Float]] %[[#]] fmin %[[Vec3FloatR1]] %[[Vec3FloatItem2]] |
| 51 |
; CHECK: OpReturnValue %[[Vec3FloatR2]] |
| 52 |
; CHECK: OpFunctionEnd |
| 53 |
|
| 54 |
; CHECK: OpFunction |
| 55 |
; CHECK: %[[ParamVec2Double:.*]] = OpFunctionParameter %[[DoubleVec2]] |
| 56 |
; CHECK: %[[Vec2DoubleItem0:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec2Double]] 0 |
| 57 |
; CHECK: %[[Vec2DoubleItem1:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec2Double]] 1 |
| 58 |
; CHECK: %[[Vec2DoubleR1:.*]] = OpExtInst %[[Double]] %[[#]] fmin %[[Vec2DoubleItem0]] %[[Vec2DoubleItem1]] |
| 59 |
; CHECK: OpReturnValue %[[Vec2DoubleR1]] |
| 60 |
; CHECK: OpFunctionEnd |
| 61 |
|
| 62 |
; CHECK: OpFunction |
| 63 |
; CHECK: %[[ParamVec3Double:.*]] = OpFunctionParameter %[[DoubleVec3]] |
| 64 |
; CHECK: %[[Vec3DoubleItem0:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec3Double]] 0 |
| 65 |
; CHECK: %[[Vec3DoubleItem1:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec3Double]] 1 |
| 66 |
; CHECK: %[[Vec3DoubleItem2:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec3Double]] 2 |
| 67 |
; CHECK: %[[Vec3DoubleR1:.*]] = OpExtInst %[[Double]] %[[#]] fmin %[[Vec3DoubleItem0]] %[[Vec3DoubleItem1]] |
| 68 |
; CHECK: %[[Vec3DoubleR2:.*]] = OpExtInst %[[Double]] %[[#]] fmin %[[Vec3DoubleR1]] %[[Vec3DoubleItem2]] |
| 69 |
; CHECK: OpReturnValue %[[Vec3DoubleR2]] |
| 70 |
; CHECK: OpFunctionEnd |
| 71 |
|
| 72 |
define spir_func half @test_vector_reduce_fminimum_v2half(<2 x half> %v) { |
| 73 |
entry: |
| 74 |
%res = call half @llvm.vector.reduce.fminimum.v2half(<2 x half> %v) |
| 75 |
ret half %res |
| 76 |
} |
| 77 |
|
| 78 |
define spir_func half @test_vector_reduce_fminimum_v3half(<3 x half> %v) { |
| 79 |
entry: |
| 80 |
%res = call half @llvm.vector.reduce.fminimum.v3half(<3 x half> %v) |
| 81 |
ret half %res |
| 82 |
} |
| 83 |
|
| 84 |
define spir_func half @test_vector_reduce_fminimum_v4half(<4 x half> %v) { |
| 85 |
entry: |
| 86 |
%res = call half @llvm.vector.reduce.fminimum.v4half(<4 x half> %v) |
| 87 |
ret half %res |
| 88 |
} |
| 89 |
|
| 90 |
define spir_func half @test_vector_reduce_fminimum_v8half(<8 x half> %v) { |
| 91 |
entry: |
| 92 |
%res = call half @llvm.vector.reduce.fminimum.v8half(<8 x half> %v) |
| 93 |
ret half %res |
| 94 |
} |
| 95 |
|
| 96 |
define spir_func half @test_vector_reduce_fminimum_v16half(<16 x half> %v) { |
| 97 |
entry: |
| 98 |
%res = call half @llvm.vector.reduce.fminimum.v16half(<16 x half> %v) |
| 99 |
ret half %res |
| 100 |
} |
| 101 |
|
| 102 |
define spir_func float @test_vector_reduce_fminimum_v2float(<2 x float> %v) { |
| 103 |
entry: |
| 104 |
%res = call float @llvm.vector.reduce.fminimum.v2float(<2 x float> %v) |
| 105 |
ret float %res |
| 106 |
} |
| 107 |
|
| 108 |
define spir_func float @test_vector_reduce_fminimum_v3float(<3 x float> %v) { |
| 109 |
entry: |
| 110 |
%res = call float @llvm.vector.reduce.fminimum.v3float(<3 x float> %v) |
| 111 |
ret float %res |
| 112 |
} |
| 113 |
|
| 114 |
define spir_func float @test_vector_reduce_fminimum_v4float(<4 x float> %v) { |
| 115 |
entry: |
| 116 |
%res = call float @llvm.vector.reduce.fminimum.v4float(<4 x float> %v) |
| 117 |
ret float %res |
| 118 |
} |
| 119 |
|
| 120 |
define spir_func float @test_vector_reduce_fminimum_v8float(<8 x float> %v) { |
| 121 |
entry: |
| 122 |
%res = call float @llvm.vector.reduce.fminimum.v8float(<8 x float> %v) |
| 123 |
ret float %res |
| 124 |
} |
| 125 |
|
| 126 |
define spir_func float @test_vector_reduce_fminimum_v16float(<16 x float> %v) { |
| 127 |
entry: |
| 128 |
%res = call float @llvm.vector.reduce.fminimum.v16float(<16 x float> %v) |
| 129 |
ret float %res |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
define spir_func double @test_vector_reduce_fminimum_v2double(<2 x double> %v) { |
| 134 |
entry: |
| 135 |
%res = call double @llvm.vector.reduce.fminimum.v2double(<2 x double> %v) |
| 136 |
ret double %res |
| 137 |
} |
| 138 |
|
| 139 |
define spir_func double @test_vector_reduce_fminimum_v3double(<3 x double> %v) { |
| 140 |
entry: |
| 141 |
%res = call double @llvm.vector.reduce.fminimum.v3double(<3 x double> %v) |
| 142 |
ret double %res |
| 143 |
} |
| 144 |
|
| 145 |
define spir_func double @test_vector_reduce_fminimum_v4double(<4 x double> %v) { |
| 146 |
entry: |
| 147 |
%res = call double @llvm.vector.reduce.fminimum.v4double(<4 x double> %v) |
| 148 |
ret double %res |
| 149 |
} |
| 150 |
|
| 151 |
define spir_func double @test_vector_reduce_fminimum_v8double(<8 x double> %v) { |
| 152 |
entry: |
| 153 |
%res = call double @llvm.vector.reduce.fminimum.v8double(<8 x double> %v) |
| 154 |
ret double %res |
| 155 |
} |
| 156 |
|
| 157 |
define spir_func double @test_vector_reduce_fminimum_v16double(<16 x double> %v) { |
| 158 |
entry: |
| 159 |
%res = call double @llvm.vector.reduce.fminimum.v16double(<16 x double> %v) |
| 160 |
ret double %res |
| 161 |
} |
| 162 |
|
| 163 |
declare half @llvm.vector.reduce.fminimum.v2half(<2 x half>) |
| 164 |
declare half @llvm.vector.reduce.fminimum.v3half(<3 x half>) |
| 165 |
declare half @llvm.vector.reduce.fminimum.v4half(<4 x half>) |
| 166 |
declare half @llvm.vector.reduce.fminimum.v8half(<8 x half>) |
| 167 |
declare half @llvm.vector.reduce.fminimum.v16half(<16 x half>) |
| 168 |
declare float @llvm.vector.reduce.fminimum.v2float(<2 x float>) |
| 169 |
declare float @llvm.vector.reduce.fminimum.v3float(<3 x float>) |
| 170 |
declare float @llvm.vector.reduce.fminimum.v4float(<4 x float>) |
| 171 |
declare float @llvm.vector.reduce.fminimum.v8float(<8 x float>) |
| 172 |
declare float @llvm.vector.reduce.fminimum.v16float(<16 x float>) |
| 173 |
declare double @llvm.vector.reduce.fminimum.v2double(<2 x double>) |
| 174 |
declare double @llvm.vector.reduce.fminimum.v3double(<3 x double>) |
| 175 |
declare double @llvm.vector.reduce.fminimum.v4double(<4 x double>) |
| 176 |
declare double @llvm.vector.reduce.fminimum.v8double(<8 x double>) |
| 177 |
declare double @llvm.vector.reduce.fminimum.v16double(<16 x double>) |