fix format; remove unnecessary parameters; rename some spec op mode guard class; remove support of float point comparison and composite type comparison; update the tests.

This commit is contained in:
qining 2016-03-31 13:57:28 -04:00
parent 135452061a
commit 5c61d8e0f9
4 changed files with 63 additions and 258 deletions

View file

@ -1229,90 +1229,8 @@ Id Builder::createOp(Op opCode, Id typeId, const std::vector<Id>& operands)
return op->getResultId();
}
Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector<Id>& operands, const std::vector<unsigned>& literals) {
switch(opCode) {
// OpCodes that do not need any capababilities.
case OpSConvert:
case OpFConvert:
case OpSNegate:
case OpNot:
case OpIAdd:
case OpISub:
case OpIMul:
case OpUDiv:
case OpSDiv:
case OpUMod:
case OpSRem:
case OpSMod:
case OpShiftRightLogical:
case OpShiftRightArithmetic:
case OpShiftLeftLogical:
case OpBitwiseOr:
case OpBitwiseXor:
case OpBitwiseAnd:
case OpVectorShuffle:
case OpCompositeExtract:
case OpCompositeInsert:
case OpLogicalOr:
case OpLogicalAnd:
case OpLogicalNot:
case OpLogicalEqual:
case OpLogicalNotEqual:
case OpSelect:
case OpIEqual:
case OpULessThan:
case OpSLessThan:
case OpUGreaterThan:
case OpSGreaterThan:
case OpULessThanEqual:
case OpSLessThanEqual:
case OpUGreaterThanEqual:
case OpSGreaterThanEqual:
// Added temporarily to enable compsite type spec constants comparison.
// Remove this comment after Spec being updated.
case OpAll:
case OpAny:
case OpFOrdEqual:
case OpFUnordEqual:
case OpFOrdNotEqual:
case OpFUnordNotEqual:
break;
// OpCodes that need Shader capability.
case OpQuantizeToF16:
addCapability(CapabilityShader);
break;
// OpCodes that need Kernel capability.
case OpConvertFToS:
case OpConvertSToF:
case OpConvertFToU:
case OpConvertUToF:
case OpUConvert:
case OpConvertPtrToU:
case OpConvertUToPtr:
case OpGenericCastToPtr:
case OpPtrCastToGeneric:
case OpBitcast:
case OpFNegate:
case OpFAdd:
case OpFSub:
case OpFMul:
case OpFDiv:
case OpFRem:
case OpFMod:
case OpAccessChain:
case OpInBoundsAccessChain:
case OpPtrAccessChain:
case OpInBoundsPtrAccessChain:
addCapability(CapabilityKernel);
break;
default:
// Invalid OpCode for Spec Constant operations.
return NoResult;
}
Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector<Id>& operands, const std::vector<unsigned>& literals)
{
Instruction* op = new Instruction(getUniqueId(), typeId, OpSpecConstantOp);
op->addImmediateOperand((unsigned) opCode);
for (auto it = operands.cbegin(); it != operands.cend(); ++it)