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 4target 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: %[[Param2Half:.*]] = OpFunctionParameter %[[Half]] 20; CHECK: %[[ParamVec2Half:.*]] = OpFunctionParameter %[[HalfVec2]] 21; CHECK: %[[Vec2HalfItem0:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec2Half]] 0 22; CHECK: %[[Vec2HalfR1:.*]] = OpFMul %[[Half]] %[[Param2Half]] %[[Vec2HalfItem0]] 23; CHECK: %[[Vec2HalfItem1:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec2Half]] 1 24; CHECK: %[[Vec2HalfR2:.*]] = OpFMul %[[Half]] %[[Vec2HalfR1]] %[[Vec2HalfItem1]] 25; CHECK: OpReturnValue %[[Vec2HalfR2]] 26; CHECK: OpFunctionEnd 27 28; CHECK: OpFunction 29; CHECK: %[[Param2Half:.*]] = OpFunctionParameter %[[Half]] 30; CHECK: %[[ParamVec3Half:.*]] = OpFunctionParameter %[[HalfVec3]] 31; CHECK: %[[Vec3HalfItem0:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec3Half]] 0 32; CHECK: %[[Vec3HalfR1:.*]] = OpFMul %[[Half]] %[[Param2Half]] %[[Vec3HalfItem0]] 33; CHECK: %[[Vec3HalfItem1:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec3Half]] 1 34; CHECK: %[[Vec3HalfR2:.*]] = OpFMul %[[Half]] %[[Vec3HalfR1]] %[[Vec3HalfItem1]] 35; CHECK: %[[Vec3HalfItem2:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec3Half]] 2 36; CHECK: %[[Vec3HalfR3:.*]] = OpFMul %[[Half]] %[[Vec3HalfR2]] %[[Vec3HalfItem2]] 37; CHECK: OpReturnValue %[[Vec3HalfR3]] 38; CHECK: OpFunctionEnd 39 40; CHECK: OpFunction 41; CHECK: %[[Param2Float:.*]] = OpFunctionParameter %[[Float]] 42; CHECK: %[[ParamVec2Float:.*]] = OpFunctionParameter %[[FloatVec2]] 43; CHECK: %[[Vec2FloatItem0:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec2Float]] 0 44; CHECK: %[[Vec2FloatR1:.*]] = OpFMul %[[Float]] %[[Param2Float]] %[[Vec2FloatItem0]] 45; CHECK: %[[Vec2FloatItem1:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec2Float]] 1 46; CHECK: %[[Vec2FloatR2:.*]] = OpFMul %[[Float]] %[[Vec2FloatR1]] %[[Vec2FloatItem1]] 47; CHECK: OpReturnValue %[[Vec2FloatR2]] 48; CHECK: OpFunctionEnd 49 50; CHECK: OpFunction 51; CHECK: %[[Param2Float:.*]] = OpFunctionParameter %[[Float]] 52; CHECK: %[[ParamVec3Float:.*]] = OpFunctionParameter %[[FloatVec3]] 53; CHECK: %[[Vec3FloatItem0:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec3Float]] 0 54; CHECK: %[[Vec3FloatR1:.*]] = OpFMul %[[Float]] %[[Param2Float]] %[[Vec3FloatItem0]] 55; CHECK: %[[Vec3FloatItem1:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec3Float]] 1 56; CHECK: %[[Vec3FloatR2:.*]] = OpFMul %[[Float]] %[[Vec3FloatR1]] %[[Vec3FloatItem1]] 57; CHECK: %[[Vec3FloatItem2:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec3Float]] 2 58; CHECK: %[[Vec3FloatR3:.*]] = OpFMul %[[Float]] %[[Vec3FloatR2]] %[[Vec3FloatItem2]] 59; CHECK: OpReturnValue %[[Vec3FloatR3]] 60; CHECK: OpFunctionEnd 61 62; CHECK: OpFunction 63; CHECK: %[[Param2Double:.*]] = OpFunctionParameter %[[Double]] 64; CHECK: %[[ParamVec2Double:.*]] = OpFunctionParameter %[[DoubleVec2]] 65; CHECK: %[[Vec2DoubleItem0:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec2Double]] 0 66; CHECK: %[[Vec2DoubleR1:.*]] = OpFMul %[[Double]] %[[Param2Double]] %[[Vec2DoubleItem0]] 67; CHECK: %[[Vec2DoubleItem1:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec2Double]] 1 68; CHECK: %[[Vec2DoubleR2:.*]] = OpFMul %[[Double]] %[[Vec2DoubleR1]] %[[Vec2DoubleItem1]] 69; CHECK: OpReturnValue %[[Vec2DoubleR2]] 70; CHECK: OpFunctionEnd 71 72; CHECK: OpFunction 73; CHECK: %[[Param2Double:.*]] = OpFunctionParameter %[[Double]] 74; CHECK: %[[ParamVec3Double:.*]] = OpFunctionParameter %[[DoubleVec3]] 75; CHECK: %[[Vec3DoubleItem0:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec3Double]] 0 76; CHECK: %[[Vec3DoubleR1:.*]] = OpFMul %[[Double]] %[[Param2Double]] %[[Vec3DoubleItem0]] 77; CHECK: %[[Vec3DoubleItem1:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec3Double]] 1 78; CHECK: %[[Vec3DoubleR2:.*]] = OpFMul %[[Double]] %[[Vec3DoubleR1]] %[[Vec3DoubleItem1]] 79; CHECK: %[[Vec3DoubleItem2:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec3Double]] 2 80; CHECK: %[[Vec3DoubleR3:.*]] = OpFMul %[[Double]] %[[Vec3DoubleR2]] %[[Vec3DoubleItem2]] 81; CHECK: OpReturnValue %[[Vec3DoubleR3]] 82; CHECK: OpFunctionEnd 83 84define spir_func half @test_vector_reduce_fmul_v2half(half %sp, <2 x half> %v) { 85entry: 86 %res = call half @llvm.vector.reduce.fmul.v2half(half %sp, <2 x half> %v) 87 ret half %res 88} 89 90define spir_func half @test_vector_reduce_fmul_v3half(half %sp, <3 x half> %v) { 91entry: 92 %res = call half @llvm.vector.reduce.fmul.v3half(half %sp, <3 x half> %v) 93 ret half %res 94} 95 96define spir_func half @test_vector_reduce_fmul_v4half(half %sp, <4 x half> %v) { 97entry: 98 %res = call half @llvm.vector.reduce.fmul.v4half(half %sp, <4 x half> %v) 99 ret half %res 100} 101 102define spir_func half @test_vector_reduce_fmul_v8half(half %sp, <8 x half> %v) { 103entry: 104 %res = call half @llvm.vector.reduce.fmul.v8half(half %sp, <8 x half> %v) 105 ret half %res 106} 107 108define spir_func half @test_vector_reduce_fmul_v16half(half %sp, <16 x half> %v) { 109entry: 110 %res = call half @llvm.vector.reduce.fmul.v16half(half %sp, <16 x half> %v) 111 ret half %res 112} 113 114define spir_func float @test_vector_reduce_fmul_v2float(float %sp, <2 x float> %v) { 115entry: 116 %res = call float @llvm.vector.reduce.fmul.v2float(float %sp, <2 x float> %v) 117 ret float %res 118} 119 120define spir_func float @test_vector_reduce_fmul_v3float(float %sp, <3 x float> %v) { 121entry: 122 %res = call float @llvm.vector.reduce.fmul.v3float(float %sp, <3 x float> %v) 123 ret float %res 124} 125 126define spir_func float @test_vector_reduce_fmul_v4float(float %sp, <4 x float> %v) { 127entry: 128 %res = call float @llvm.vector.reduce.fmul.v4float(float %sp, <4 x float> %v) 129 ret float %res 130} 131 132define spir_func float @test_vector_reduce_fmul_v8float(float %sp, <8 x float> %v) { 133entry: 134 %res = call float @llvm.vector.reduce.fmul.v8float(float %sp, <8 x float> %v) 135 ret float %res 136} 137 138define spir_func float @test_vector_reduce_fmul_v16float(float %sp, <16 x float> %v) { 139entry: 140 %res = call float @llvm.vector.reduce.fmul.v16float(float %sp, <16 x float> %v) 141 ret float %res 142} 143 144 145define spir_func double @test_vector_reduce_fmul_v2double(double %sp, <2 x double> %v) { 146entry: 147 %res = call double @llvm.vector.reduce.fmul.v2double(double %sp, <2 x double> %v) 148 ret double %res 149} 150 151define spir_func double @test_vector_reduce_fmul_v3double(double %sp, <3 x double> %v) { 152entry: 153 %res = call double @llvm.vector.reduce.fmul.v3double(double %sp, <3 x double> %v) 154 ret double %res 155} 156 157define spir_func double @test_vector_reduce_fmul_v4double(double %sp, <4 x double> %v) { 158entry: 159 %res = call double @llvm.vector.reduce.fmul.v4double(double %sp, <4 x double> %v) 160 ret double %res 161} 162 163define spir_func double @test_vector_reduce_fmul_v8double(double %sp, <8 x double> %v) { 164entry: 165 %res = call double @llvm.vector.reduce.fmul.v8double(double %sp, <8 x double> %v) 166 ret double %res 167} 168 169define spir_func double @test_vector_reduce_fmul_v16double(double %sp, <16 x double> %v) { 170entry: 171 %res = call double @llvm.vector.reduce.fmul.v16double(double %sp, <16 x double> %v) 172 ret double %res 173} 174 175declare half @llvm.vector.reduce.fmul.v2half(half, <2 x half>) 176declare half @llvm.vector.reduce.fmul.v3half(half, <3 x half>) 177declare half @llvm.vector.reduce.fmul.v4half(half, <4 x half>) 178declare half @llvm.vector.reduce.fmul.v8half(half, <8 x half>) 179declare half @llvm.vector.reduce.fmul.v16half(half, <16 x half>) 180declare float @llvm.vector.reduce.fmul.v2float(float, <2 x float>) 181declare float @llvm.vector.reduce.fmul.v3float(float, <3 x float>) 182declare float @llvm.vector.reduce.fmul.v4float(float, <4 x float>) 183declare float @llvm.vector.reduce.fmul.v8float(float, <8 x float>) 184declare float @llvm.vector.reduce.fmul.v16float(float, <16 x float>) 185declare double @llvm.vector.reduce.fmul.v2double(double, <2 x double>) 186declare double @llvm.vector.reduce.fmul.v3double(double, <3 x double>) 187declare double @llvm.vector.reduce.fmul.v4double(double, <4 x double>) 188declare double @llvm.vector.reduce.fmul.v8double(double, <8 x double>) 189declare double @llvm.vector.reduce.fmul.v16double(double, <16 x double>) 190