Validates correctness of bitwise instructions.
| 228 | |
| 229 | // Validates correctness of bitwise instructions. |
| 230 | spv_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 |
no test coverage detected