Validates correctness of arithmetic instructions.
| 840 | |
| 841 | // Validates correctness of arithmetic instructions. |
| 842 | spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { |
| 843 | switch (inst->opcode()) { |
| 844 | case spv::Op::OpFAdd: |
| 845 | case spv::Op::OpFSub: |
| 846 | case spv::Op::OpFMul: |
| 847 | case spv::Op::OpFDiv: |
| 848 | case spv::Op::OpFRem: |
| 849 | case spv::Op::OpFMod: |
| 850 | case spv::Op::OpFNegate: |
| 851 | case spv::Op::OpFmaKHR: |
| 852 | return ValidateFloat(_, inst); |
| 853 | case spv::Op::OpUDiv: |
| 854 | case spv::Op::OpUMod: |
| 855 | return ValidateUnsignedInt(_, inst); |
| 856 | case spv::Op::OpISub: |
| 857 | case spv::Op::OpIAdd: |
| 858 | case spv::Op::OpIMul: |
| 859 | case spv::Op::OpSDiv: |
| 860 | case spv::Op::OpSMod: |
| 861 | case spv::Op::OpSRem: |
| 862 | case spv::Op::OpSNegate: |
| 863 | return ValidateSignedInt(_, inst); |
| 864 | case spv::Op::OpDot: |
| 865 | return ValidateDot(_, inst); |
| 866 | case spv::Op::OpVectorTimesScalar: |
| 867 | return ValidateVectorTimesScalar(_, inst); |
| 868 | case spv::Op::OpMatrixTimesScalar: |
| 869 | return ValidateMatrixTimesScalar(_, inst); |
| 870 | case spv::Op::OpVectorTimesMatrix: |
| 871 | return ValidateVectorTimesMatrix(_, inst); |
| 872 | case spv::Op::OpMatrixTimesVector: |
| 873 | return ValidateMatrixTimesVector(_, inst); |
| 874 | case spv::Op::OpMatrixTimesMatrix: |
| 875 | return ValidateMatrixTimesMatrix(_, inst); |
| 876 | case spv::Op::OpOuterProduct: |
| 877 | return ValidateOuterProduct(_, inst); |
| 878 | case spv::Op::OpIAddCarry: |
| 879 | case spv::Op::OpISubBorrow: |
| 880 | case spv::Op::OpUMulExtended: |
| 881 | case spv::Op::OpSMulExtended: |
| 882 | return ValidateExtendedCarry(_, inst); |
| 883 | case spv::Op::OpCooperativeMatrixMulAddNV: |
| 884 | return ValidateCooperativeMatrixMulAddNV(_, inst); |
| 885 | case spv::Op::OpCooperativeMatrixMulAddKHR: |
| 886 | return ValidateCooperativeMatrixMulAddKHR(_, inst); |
| 887 | case spv::Op::OpCooperativeMatrixReduceNV: |
| 888 | return ValidateCooperativeMatrixReduceNV(_, inst); |
| 889 | |
| 890 | case spv::Op::OpSpecConstantOp: { |
| 891 | switch (inst->GetOperandAs<spv::Op>(2u)) { |
| 892 | case spv::Op::OpFAdd: |
| 893 | case spv::Op::OpFSub: |
| 894 | case spv::Op::OpFMul: |
| 895 | case spv::Op::OpFDiv: |
| 896 | case spv::Op::OpFRem: |
| 897 | case spv::Op::OpFMod: |
| 898 | case spv::Op::OpFNegate: |
| 899 | return ValidateFloat(_, inst, 3); |
no test coverage detected