| 1 |
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-vulkan %s -o - | FileCheck %s |
| 2 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val %} |
| 3 |
|
| 4 |
; CHECK-DAG: [[glsl_450_ext:%.+]] = OpExtInstImport "GLSL.std.450" |
| 5 |
; CHECK-DAG: OpMemoryModel Logical GLSL450 |
| 6 |
; CHECK-DAG: [[u32_t:%.+]] = OpTypeInt 32 0 |
| 7 |
; CHECK-DAG: [[u32x2_t:%.+]] = OpTypeVector [[u32_t]] 2 |
| 8 |
; CHECK-DAG: [[u32x3_t:%.+]] = OpTypeVector [[u32_t]] 3 |
| 9 |
; CHECK-DAG: [[u32x4_t:%.+]] = OpTypeVector [[u32_t]] 4 |
| 10 |
; CHECK-DAG: [[const_0:%.*]] = OpConstant [[u32_t]] 0 |
| 11 |
; CHECK-DAG: [[const_2:%.*]] = OpConstant [[u32_t]] 2 |
| 12 |
; CHECK-DAG: [[const_0x2:%.*]] = OpConstantComposite [[u32x2_t]] [[const_0]] [[const_0]] |
| 13 |
; CHECK-DAG: [[const_1:%.*]] = OpConstant [[u32_t]] 1 |
| 14 |
; CHECK-DAG: [[const_32:%.*]] = OpConstant [[u32_t]] 32 |
| 15 |
; CHECK-DAG: [[const_32x2:%.*]] = OpConstantComposite [[u32x2_t]] [[const_32]] [[const_32]] |
| 16 |
; CHECK-DAG: [[const_neg1:%.*]] = OpConstant [[u32_t]] 4294967295 |
| 17 |
; CHECK-DAG: [[const_neg1x2:%.*]] = OpConstantComposite [[u32x2_t]] [[const_neg1]] [[const_neg1]] |
| 18 |
; CHECK-DAG: [[u16_t:%.+]] = OpTypeInt 16 0 |
| 19 |
; CHECK-DAG: [[u16x2_t:%.+]] = OpTypeVector [[u16_t]] 2 |
| 20 |
; CHECK-DAG: [[u16x3_t:%.+]] = OpTypeVector [[u16_t]] 3 |
| 21 |
; CHECK-DAG: [[u16x4_t:%.+]] = OpTypeVector [[u16_t]] 4 |
| 22 |
; CHECK-DAG: [[u64_t:%.+]] = OpTypeInt 64 0 |
| 23 |
; CHECK-DAG: [[u64x2_t:%.+]] = OpTypeVector [[u64_t]] 2 |
| 24 |
; CHECK-DAG: [[u64x3_t:%.+]] = OpTypeVector [[u64_t]] 3 |
| 25 |
; CHECK-DAG: [[u64x4_t:%.+]] = OpTypeVector [[u64_t]] 4 |
| 26 |
; CHECK-DAG: [[bool_t:%.+]] = OpTypeBool |
| 27 |
; CHECK-DAG: [[boolx2_t:%.+]] = OpTypeVector [[bool_t]] 2 |
| 28 |
|
| 29 |
; CHECK-LABEL: Begin function firstbituhigh_i32 |
| 30 |
define noundef i32 @firstbituhigh_i32(i32 noundef %a) { |
| 31 |
entry: |
| 32 |
; CHECK: [[a:%.+]] = OpFunctionParameter [[u32_t]] |
| 33 |
; CHECK: [[ret:%.+]] = OpExtInst [[u32_t]] [[glsl_450_ext]] FindUMsb [[a]] |
| 34 |
; CHECK: OpReturnValue [[ret]] |
| 35 |
%elt.firstbituhigh = call i32 @llvm.spv.firstbituhigh.i32(i32 %a) |
| 36 |
ret i32 %elt.firstbituhigh |
| 37 |
} |
| 38 |
|
| 39 |
; CHECK-LABEL: Begin function firstbituhigh_v2xi32 |
| 40 |
define noundef <2 x i32> @firstbituhigh_v2xi32(<2 x i32> noundef %a) { |
| 41 |
entry: |
| 42 |
; CHECK: [[a:%.+]] = OpFunctionParameter [[u32x2_t]] |
| 43 |
; CHECK: [[ret:%.+]] = OpExtInst [[u32x2_t]] [[glsl_450_ext]] FindUMsb [[a]] |
| 44 |
; CHECK: OpReturnValue [[ret]] |
| 45 |
%elt.firstbituhigh = call <2 x i32> @llvm.spv.firstbituhigh.v2i32(<2 x i32> %a) |
| 46 |
ret <2 x i32> %elt.firstbituhigh |
| 47 |
} |
| 48 |
|
| 49 |
; CHECK-LABEL: Begin function firstbituhigh_v3xi32 |
| 50 |
define noundef <3 x i32> @firstbituhigh_v3xi32(<3 x i32> noundef %a) { |
| 51 |
entry: |
| 52 |
; CHECK: [[a:%.+]] = OpFunctionParameter [[u32x3_t]] |
| 53 |
; CHECK: [[ret:%.+]] = OpExtInst [[u32x3_t]] [[glsl_450_ext]] FindUMsb [[a]] |
| 54 |
; CHECK: OpReturnValue [[ret]] |
| 55 |
%elt.firstbituhigh = call <3 x i32> @llvm.spv.firstbituhigh.v3i32(<3 x i32> %a) |
| 56 |
ret <3 x i32> %elt.firstbituhigh |
| 57 |
} |
| 58 |
|
| 59 |
; CHECK-LABEL: Begin function firstbituhigh_v4xi32 |
| 60 |
define noundef <4 x i32> @firstbituhigh_v4xi32(<4 x i32> noundef %a) { |
| 61 |
entry: |
| 62 |
; CHECK: [[a:%.+]] = OpFunctionParameter [[u32x4_t]] |
| 63 |
; CHECK: [[ret:%.+]] = OpExtInst [[u32x4_t]] [[glsl_450_ext]] FindUMsb [[a]] |
| 64 |
; CHECK: OpReturnValue [[ret]] |
| 65 |
%elt.firstbituhigh = call <4 x i32> @llvm.spv.firstbituhigh.v4i32(<4 x i32> %a) |
| 66 |
ret <4 x i32> %elt.firstbituhigh |
| 67 |
} |
| 68 |
|
| 69 |
; CHECK-LABEL: Begin function firstbituhigh_i16 |
| 70 |
define noundef i32 @firstbituhigh_i16(i16 noundef %a) { |
| 71 |
entry: |
| 72 |
; CHECK: [[a16:%.+]] = OpFunctionParameter [[u16_t]] |
| 73 |
; CHECK: [[a32:%.+]] = OpUConvert [[u32_t]] [[a16]] |
| 74 |
; CHECK: [[ret:%.+]] = OpExtInst [[u32_t]] [[glsl_450_ext]] FindUMsb [[a32]] |
| 75 |
; CHECK: OpReturnValue [[ret]] |
| 76 |
%elt.firstbituhigh = call i32 @llvm.spv.firstbituhigh.i16(i16 %a) |
| 77 |
ret i32 %elt.firstbituhigh |
| 78 |
} |
| 79 |
|
| 80 |
; CHECK-LABEL: Begin function firstbituhigh_v2xi16 |
| 81 |
define noundef <2 x i32> @firstbituhigh_v2xi16(<2 x i16> noundef %a) { |
| 82 |
entry: |
| 83 |
; CHECK: [[a16:%.+]] = OpFunctionParameter [[u16x2_t]] |
| 84 |
; CHECK: [[a32:%.+]] = OpUConvert [[u32x2_t]] [[a16]] |
| 85 |
; CHECK: [[ret:%.+]] = OpExtInst [[u32x2_t]] [[glsl_450_ext]] FindUMsb [[a32]] |
| 86 |
; CHECK: OpReturnValue [[ret]] |
| 87 |
%elt.firstbituhigh = call <2 x i32> @llvm.spv.firstbituhigh.v2i16(<2 x i16> %a) |
| 88 |
ret <2 x i32> %elt.firstbituhigh |
| 89 |
} |
| 90 |
|
| 91 |
; CHECK-LABEL: Begin function firstbituhigh_v3xi16 |
| 92 |
define noundef <3 x i32> @firstbituhigh_v3xi16(<3 x i16> noundef %a) { |
| 93 |
entry: |
| 94 |
; CHECK: [[a16:%.+]] = OpFunctionParameter [[u16x3_t]] |
| 95 |
; CHECK: [[a32:%.+]] = OpUConvert [[u32x3_t]] [[a16]] |
| 96 |
; CHECK: [[ret:%.+]] = OpExtInst [[u32x3_t]] [[glsl_450_ext]] FindUMsb [[a32]] |
| 97 |
; CHECK: OpReturnValue [[ret]] |
| 98 |
%elt.firstbituhigh = call <3 x i32> @llvm.spv.firstbituhigh.v3i16(<3 x i16> %a) |
| 99 |
ret <3 x i32> %elt.firstbituhigh |
| 100 |
} |
| 101 |
|
| 102 |
; CHECK-LABEL: Begin function firstbituhigh_v4xi16 |
| 103 |
define noundef <4 x i32> @firstbituhigh_v4xi16(<4 x i16> noundef %a) { |
| 104 |
entry: |
| 105 |
; CHECK: [[a16:%.+]] = OpFunctionParameter [[u16x4_t]] |
| 106 |
; CHECK: [[a32:%.+]] = OpUConvert [[u32x4_t]] [[a16]] |
| 107 |
; CHECK: [[ret:%.+]] = OpExtInst [[u32x4_t]] [[glsl_450_ext]] FindUMsb [[a32]] |
| 108 |
; CHECK: OpReturnValue [[ret]] |
| 109 |
%elt.firstbituhigh = call <4 x i32> @llvm.spv.firstbituhigh.v4i16(<4 x i16> %a) |
| 110 |
ret <4 x i32> %elt.firstbituhigh |
| 111 |
} |
| 112 |
|
| 113 |
; CHECK-LABEL: Begin function firstbituhigh_i64 |
| 114 |
define noundef i32 @firstbituhigh_i64(i64 noundef %a) { |
| 115 |
entry: |
| 116 |
; CHECK: [[a64:%.+]] = OpFunctionParameter [[u64_t]] |
| 117 |
; CHECK: [[a32x2:%.+]] = OpBitcast [[u32x2_t]] [[a64]] |
| 118 |
; CHECK: [[lsb_bits:%.+]] = OpExtInst [[u32x2_t]] [[glsl_450_ext]] FindUMsb [[a32x2]] |
| 119 |
; CHECK: [[high_bits:%.+]] = OpVectorExtractDynamic [[u32_t]] [[lsb_bits]] [[const_0]] |
| 120 |
; CHECK: [[low_bits:%.+]] = OpVectorExtractDynamic [[u32_t]] [[lsb_bits]] [[const_1]] |
| 121 |
; CHECK: [[should_use_low:%.+]] = OpIEqual [[bool_t]] [[high_bits]] [[const_neg1]] |
| 122 |
; CHECK: [[ans_bits:%.+]] = OpSelect [[u32_t]] [[should_use_low]] [[low_bits]] [[high_bits]] |
| 123 |
; CHECK: [[ans_offset:%.+]] = OpSelect [[u32_t]] [[should_use_low]] [[const_0]] [[const_32]] |
| 124 |
; CHECK: [[ret:%.+]] = OpIAdd [[u32_t]] [[ans_offset]] [[ans_bits]] |
| 125 |
; CHECK: OpReturnValue [[ret]] |
| 126 |
%elt.firstbituhigh = call i32 @llvm.spv.firstbituhigh.i64(i64 %a) |
| 127 |
ret i32 %elt.firstbituhigh |
| 128 |
} |
| 129 |
|
| 130 |
; CHECK-LABEL: Begin function firstbituhigh_v2xi64 |
| 131 |
define noundef <2 x i32> @firstbituhigh_v2xi64(<2 x i64> noundef %a) { |
| 132 |
entry: |
| 133 |
; CHECK: [[a64x2:%.+]] = OpFunctionParameter [[u64x2_t]] |
| 134 |
; CHECK: [[a32x4:%.+]] = OpBitcast [[u32x4_t]] [[a64x2]] |
| 135 |
; CHECK: [[lsb_bits:%.+]] = OpExtInst [[u32x4_t]] [[glsl_450_ext]] FindUMsb [[a32x4]] |
| 136 |
; CHECK: [[high_bits:%.+]] = OpVectorShuffle [[u32x2_t]] [[lsb_bits]] [[lsb_bits]] 0 2 |
| 137 |
; CHECK: [[low_bits:%.+]] = OpVectorShuffle [[u32x2_t]] [[lsb_bits]] [[lsb_bits]] 1 3 |
| 138 |
; CHECK: [[should_use_low:%.+]] = OpIEqual [[boolx2_t]] [[high_bits]] [[const_neg1x2]] |
| 139 |
; CHECK: [[ans_bits:%.+]] = OpSelect [[u32x2_t]] [[should_use_low]] [[low_bits]] [[high_bits]] |
| 140 |
; CHECK: [[ans_offset:%.+]] = OpSelect [[u32x2_t]] [[should_use_low]] [[const_0x2]] [[const_32x2]] |
| 141 |
; CHECK: [[ret:%.+]] = OpIAdd [[u32x2_t]] [[ans_offset]] [[ans_bits]] |
| 142 |
; CHECK: OpReturnValue [[ret]] |
| 143 |
%elt.firstbituhigh = call <2 x i32> @llvm.spv.firstbituhigh.v2i64(<2 x i64> %a) |
| 144 |
ret <2 x i32> %elt.firstbituhigh |
| 145 |
} |
| 146 |
|
| 147 |
; CHECK-LABEL: Begin function firstbituhigh_v3xi64 |
| 148 |
define noundef <3 x i32> @firstbituhigh_v3xi64(<3 x i64> noundef %a) { |
| 149 |
entry: |
| 150 |
; Preamble |
| 151 |
; CHECK: [[a:%.+]] = OpFunctionParameter [[u64x3_t]] |
| 152 |
|
| 153 |
; Extract first 2 components from %a |
| 154 |
; CHECK: [[pt1:%.+]] = OpVectorShuffle [[u64x2_t]] [[a]] [[a]] 0 1 |
| 155 |
|
| 156 |
; Do firstbituhigh on the first 2 components |
| 157 |
; CHECK: [[pt1_cast:%.+]] = OpBitcast [[u32x4_t]] [[pt1]] |
| 158 |
; CHECK: [[pt1_lsb_bits:%.+]] = OpExtInst [[u32x4_t]] [[glsl_450_ext]] FindUMsb [[pt1_cast]] |
| 159 |
; CHECK: [[pt1_high_bits:%.+]] = OpVectorShuffle [[u32x2_t]] [[pt1_lsb_bits]] [[pt1_lsb_bits]] 0 2 |
| 160 |
; CHECK: [[pt1_low_bits:%.+]] = OpVectorShuffle [[u32x2_t]] [[pt1_lsb_bits]] [[pt1_lsb_bits]] 1 3 |
| 161 |
; CHECK: [[pt1_should_use_low:%.+]] = OpIEqual [[boolx2_t]] [[pt1_high_bits]] [[const_neg1x2]] |
| 162 |
; CHECK: [[pt1_ans_bits:%.+]] = OpSelect [[u32x2_t]] [[pt1_should_use_low]] [[pt1_low_bits]] [[pt1_high_bits]] |
| 163 |
; CHECK: [[pt1_ans_offset:%.+]] = OpSelect [[u32x2_t]] [[pt1_should_use_low]] [[const_0x2]] [[const_32x2]] |
| 164 |
; CHECK: [[pt1_res:%.+]] = OpIAdd [[u32x2_t]] [[pt1_ans_offset]] [[pt1_ans_bits]] |
| 165 |
|
| 166 |
; Extract the last component from %a |
| 167 |
; CHECK: [[pt2:%.+]] = OpVectorExtractDynamic [[u64_t]] [[a]] [[const_2]] |
| 168 |
|
| 169 |
; Do firstbituhigh on the last component |
| 170 |
; CHECK: [[pt2_cast:%.+]] = OpBitcast [[u32x2_t]] [[pt2]] |
| 171 |
; CHECK: [[pt2_lsb_bits:%.+]] = OpExtInst [[u32x2_t]] [[glsl_450_ext]] FindUMsb [[pt2_cast]] |
| 172 |
; CHECK: [[pt2_high_bits:%.+]] = OpVectorExtractDynamic [[u32_t]] [[pt2_lsb_bits]] [[const_0]] |
| 173 |
; CHECK: [[pt2_low_bits:%.+]] = OpVectorExtractDynamic [[u32_t]] [[pt2_lsb_bits]] [[const_1]] |
| 174 |
; CHECK: [[pt2_should_use_low:%.+]] = OpIEqual [[bool_t]] [[pt2_high_bits]] [[const_neg1]] |
| 175 |
; CHECK: [[pt2_ans_bits:%.+]] = OpSelect [[u32_t]] [[pt2_should_use_low]] [[pt2_low_bits]] [[pt2_high_bits]] |
| 176 |
; CHECK: [[pt2_ans_offset:%.+]] = OpSelect [[u32_t]] [[pt2_should_use_low]] [[const_0]] [[const_32]] |
| 177 |
; CHECK: [[pt2_res:%.+]] = OpIAdd [[u32_t]] [[pt2_ans_offset]] [[pt2_ans_bits]] |
| 178 |
|
| 179 |
; Merge the parts into the final i32x3 and return it |
| 180 |
; CHECK: [[ret:%.+]] = OpCompositeConstruct [[u32x3_t]] [[pt1_res]] [[pt2_res]] |
| 181 |
; CHECK: OpReturnValue [[ret]] |
| 182 |
%elt.firstbituhigh = call <3 x i32> @llvm.spv.firstbituhigh.v3i64(<3 x i64> %a) |
| 183 |
ret <3 x i32> %elt.firstbituhigh |
| 184 |
} |
| 185 |
|
| 186 |
; CHECK-LABEL: Begin function firstbituhigh_v4xi64 |
| 187 |
define noundef <4 x i32> @firstbituhigh_v4xi64(<4 x i64> noundef %a) { |
| 188 |
entry: |
| 189 |
; Preamble |
| 190 |
; CHECK: [[a:%.+]] = OpFunctionParameter [[u64x4_t]] |
| 191 |
|
| 192 |
; Extract first 2 components from %a |
| 193 |
; CHECK: [[pt1:%.+]] = OpVectorShuffle [[u64x2_t]] [[a]] [[a]] 0 1 |
| 194 |
|
| 195 |
; Do firstbituhigh on the first 2 components |
| 196 |
; CHECK: [[pt1_cast:%.+]] = OpBitcast [[u32x4_t]] [[pt1]] |
| 197 |
; CHECK: [[pt1_lsb_bits:%.+]] = OpExtInst [[u32x4_t]] [[glsl_450_ext]] FindUMsb [[pt1_cast]] |
| 198 |
; CHECK: [[pt1_high_bits:%.+]] = OpVectorShuffle [[u32x2_t]] [[pt1_lsb_bits]] [[pt1_lsb_bits]] 0 2 |
| 199 |
; CHECK: [[pt1_low_bits:%.+]] = OpVectorShuffle [[u32x2_t]] [[pt1_lsb_bits]] [[pt1_lsb_bits]] 1 3 |
| 200 |
; CHECK: [[pt1_should_use_low:%.+]] = OpIEqual [[boolx2_t]] [[pt1_high_bits]] [[const_neg1x2]] |
| 201 |
; CHECK: [[pt1_ans_bits:%.+]] = OpSelect [[u32x2_t]] [[pt1_should_use_low]] [[pt1_low_bits]] [[pt1_high_bits]] |
| 202 |
; CHECK: [[pt1_ans_offset:%.+]] = OpSelect [[u32x2_t]] [[pt1_should_use_low]] [[const_0x2]] [[const_32x2]] |
| 203 |
; CHECK: [[pt1_res:%.+]] = OpIAdd [[u32x2_t]] [[pt1_ans_offset]] [[pt1_ans_bits]] |
| 204 |
|
| 205 |
; Extract last 2 components from %a |
| 206 |
; CHECK: [[pt2:%.+]] = OpVectorShuffle [[u64x2_t]] [[a]] [[a]] 2 3 |
| 207 |
|
| 208 |
; Do firstbituhigh on the last 2 components |
| 209 |
; CHECK: [[pt2_cast:%.+]] = OpBitcast [[u32x4_t]] [[pt2]] |
| 210 |
; CHECK: [[pt2_lsb_bits:%.+]] = OpExtInst [[u32x4_t]] [[glsl_450_ext]] FindUMsb [[pt2_cast]] |
| 211 |
; CHECK: [[pt2_high_bits:%.+]] = OpVectorShuffle [[u32x2_t]] [[pt2_lsb_bits]] [[pt2_lsb_bits]] 0 2 |
| 212 |
; CHECK: [[pt2_low_bits:%.+]] = OpVectorShuffle [[u32x2_t]] [[pt2_lsb_bits]] [[pt2_lsb_bits]] 1 3 |
| 213 |
; CHECK: [[pt2_should_use_low:%.+]] = OpIEqual [[boolx2_t]] [[pt2_high_bits]] [[const_neg1x2]] |
| 214 |
; CHECK: [[pt2_ans_bits:%.+]] = OpSelect [[u32x2_t]] [[pt2_should_use_low]] [[pt2_low_bits]] [[pt2_high_bits]] |
| 215 |
; CHECK: [[pt2_ans_offset:%.+]] = OpSelect [[u32x2_t]] [[pt2_should_use_low]] [[const_0x2]] [[const_32x2]] |
| 216 |
; CHECK: [[pt2_res:%.+]] = OpIAdd [[u32x2_t]] [[pt2_ans_offset]] [[pt2_ans_bits]] |
| 217 |
|
| 218 |
; Merge the parts into the final i32x4 and return it |
| 219 |
; CHECK: [[ret:%.+]] = OpCompositeConstruct [[u32x4_t]] [[pt1_res]] [[pt2_res]] |
| 220 |
; CHECK: OpReturnValue [[ret]] |
| 221 |
%elt.firstbituhigh = call <4 x i32> @llvm.spv.firstbituhigh.v4i64(<4 x i64> %a) |
| 222 |
ret <4 x i32> %elt.firstbituhigh |
| 223 |
} |
| 224 |
|
| 225 |
; CHECK-LABEL: Begin function firstbitshigh_i32 |
| 226 |
define noundef i32 @firstbitshigh_i32(i32 noundef %a) { |
| 227 |
entry: |
| 228 |
; CHECK: [[a:%.+]] = OpFunctionParameter [[u32_t]] |
| 229 |
; CHECK: [[ret:%.+]] = OpExtInst [[u32_t]] [[glsl_450_ext]] FindSMsb [[a]] |
| 230 |
; CHECK: OpReturnValue [[ret]] |
| 231 |
%elt.firstbitshigh = call i32 @llvm.spv.firstbitshigh.i32(i32 %a) |
| 232 |
ret i32 %elt.firstbitshigh |
| 233 |
} |
| 234 |
|
| 235 |
; CHECK-LABEL: Begin function firstbitshigh_i16 |
| 236 |
define noundef i32 @firstbitshigh_i16(i16 noundef %a) { |
| 237 |
entry: |
| 238 |
; CHECK: [[a16:%.+]] = OpFunctionParameter [[u16_t]] |
| 239 |
; CHECK: [[a32:%.+]] = OpSConvert [[u32_t]] [[a16]] |
| 240 |
; CHECK: [[ret:%.+]] = OpExtInst [[u32_t]] [[glsl_450_ext]] FindSMsb [[a32]] |
| 241 |
; CHECK: OpReturnValue [[ret]] |
| 242 |
%elt.firstbitshigh = call i32 @llvm.spv.firstbitshigh.i16(i16 %a) |
| 243 |
ret i32 %elt.firstbitshigh |
| 244 |
} |
| 245 |
|
| 246 |
; CHECK-LABEL: Begin function firstbitshigh_i64 |
| 247 |
define noundef i32 @firstbitshigh_i64(i64 noundef %a) { |
| 248 |
entry: |
| 249 |
; CHECK: [[a64:%.+]] = OpFunctionParameter [[u64_t]] |
| 250 |
; CHECK: [[a32x2:%.+]] = OpBitcast [[u32x2_t]] [[a64]] |
| 251 |
; CHECK: [[lsb_bits:%.+]] = OpExtInst [[u32x2_t]] [[glsl_450_ext]] FindSMsb [[a32x2]] |
| 252 |
; CHECK: [[high_bits:%.+]] = OpVectorExtractDynamic [[u32_t]] [[lsb_bits]] [[const_0]] |
| 253 |
; CHECK: [[low_bits:%.+]] = OpVectorExtractDynamic [[u32_t]] [[lsb_bits]] [[const_1]] |
| 254 |
; CHECK: [[should_use_low:%.+]] = OpIEqual [[bool_t]] [[high_bits]] [[const_neg1]] |
| 255 |
; CHECK: [[ans_bits:%.+]] = OpSelect [[u32_t]] [[should_use_low]] [[low_bits]] [[high_bits]] |
| 256 |
; CHECK: [[ans_offset:%.+]] = OpSelect [[u32_t]] [[should_use_low]] [[const_0]] [[const_32]] |
| 257 |
; CHECK: [[ret:%.+]] = OpIAdd [[u32_t]] [[ans_offset]] [[ans_bits]] |
| 258 |
; CHECK: OpReturnValue [[ret]] |
| 259 |
%elt.firstbitshigh = call i32 @llvm.spv.firstbitshigh.i64(i64 %a) |
| 260 |
ret i32 %elt.firstbitshigh |
| 261 |
} |
| 262 |
|
| 263 |
;declare i16 @llvm.spv.firstbituhigh.i16(i16) |
| 264 |
;declare i32 @llvm.spv.firstbituhigh.i32(i32) |
| 265 |
;declare i64 @llvm.spv.firstbituhigh.i64(i64) |
| 266 |
;declare i16 @llvm.spv.firstbituhigh.v2i16(<2 x i16>) |
| 267 |
;declare i32 @llvm.spv.firstbituhigh.v2i32(<2 x i32>) |
| 268 |
;declare i64 @llvm.spv.firstbituhigh.v2i64(<2 x i64>) |
| 269 |
;declare i16 @llvm.spv.firstbitshigh.i16(i16) |
| 270 |
;declare i32 @llvm.spv.firstbitshigh.i32(i32) |
| 271 |
;declare i64 @llvm.spv.firstbitshigh.i64(i64) |
| 272 |
;declare i16 @llvm.spv.firstbitshigh.v2i16(<2 x i16>) |
| 273 |
;declare i32 @llvm.spv.firstbitshigh.v2i32(<2 x i32>) |
| 274 |
;declare i64 @llvm.spv.firstbitshigh.v2i64(<2 x i64>) |