Constant Propagation for OPCODE_VECTOR_ADD

This commit is contained in:
Dr. Chat
2016-06-12 21:41:02 -05:00
parent eb7b80bf7c
commit 0ef16b10e2
3 changed files with 91 additions and 0 deletions

View File

@@ -622,6 +622,16 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder) {
i->Remove();
}
break;
case OPCODE_VECTOR_ADD:
if (i->src1.value->IsConstant() && i->src2.value->IsConstant()) {
v->set_from(i->src1.value);
uint32_t arith_flags = i->flags >> 8;
v->VectorAdd(i->src2.value, hir::TypeName(i->flags & 0xFF),
!!(arith_flags & ARITHMETIC_UNSIGNED),
!!(arith_flags & ARITHMETIC_SATURATE));
i->Remove();
}
break;
case OPCODE_VECTOR_SUB:
if (i->src1.value->IsConstant() && i->src2.value->IsConstant()) {
v->set_from(i->src1.value);