MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / BitwisePass

Function BitwisePass

source/val/validate_bitwise.cpp:230–273  ·  view source on GitHub ↗

Validates correctness of bitwise instructions.

Source from the content-addressed store, hash-verified

228
229// Validates correctness of bitwise instructions.
230spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst) {
231 switch (inst->opcode()) {
232 case spv::Op::OpShiftRightLogical:
233 case spv::Op::OpShiftRightArithmetic:
234 case spv::Op::OpShiftLeftLogical:
235 return ValidateShift(_, inst);
236 case spv::Op::OpBitwiseOr:
237 case spv::Op::OpBitwiseXor:
238 case spv::Op::OpBitwiseAnd:
239 case spv::Op::OpNot:
240 return ValidateBitwise(_, inst);
241 case spv::Op::OpBitFieldInsert:
242 return ValidateBitFieldInsert(_, inst);
243 case spv::Op::OpBitFieldSExtract:
244 case spv::Op::OpBitFieldUExtract:
245 return ValidateBitFieldExtract(_, inst);
246 case spv::Op::OpBitReverse:
247 return ValidateBitReverse(_, inst);
248 case spv::Op::OpBitCount:
249 return ValidateBitCount(_, inst);
250
251 case spv::Op::OpSpecConstantOp: {
252 switch (inst->GetOperandAs<spv::Op>(2u)) {
253 case spv::Op::OpShiftRightLogical:
254 case spv::Op::OpShiftRightArithmetic:
255 case spv::Op::OpShiftLeftLogical:
256 return ValidateShift(_, inst, 3);
257 case spv::Op::OpBitwiseOr:
258 case spv::Op::OpBitwiseXor:
259 case spv::Op::OpBitwiseAnd:
260 case spv::Op::OpNot:
261 return ValidateBitwise(_, inst, 3);
262 default:
263 break;
264 }
265 break;
266 }
267
268 default:
269 break;
270 }
271
272 return SPV_SUCCESS;
273}
274
275} // namespace val
276} // namespace spvtools

Calls 7

ValidateShiftFunction · 0.85
ValidateBitwiseFunction · 0.85
ValidateBitFieldInsertFunction · 0.85
ValidateBitFieldExtractFunction · 0.85
ValidateBitReverseFunction · 0.85
ValidateBitCountFunction · 0.85
opcodeMethod · 0.45

Tested by

no test coverage detected