VectorAdd and saturation checks.

This commit is contained in:
Ben Vanik
2014-01-09 21:57:07 -08:00
parent 2980a30f30
commit 3fbebcfa08
11 changed files with 251 additions and 23 deletions

View File

@@ -1052,6 +1052,15 @@ Value* HIRBuilder::DidOverflow(Value* value) {
return i->dest;
}
Value* HIRBuilder::DidSaturate(Value* value) {
Instr* i = AppendInstr(
OPCODE_DID_SATURATE_info, 0,
AllocValue(INT8_TYPE));
i->set_src1(value);
i->src2.value = i->src3.value = NULL;
return i->dest;
}
Value* HIRBuilder::VectorCompareXX(
const OpcodeInfo& opcode, Value* value1, Value* value2,
TypeName part_type) {
@@ -1140,6 +1149,24 @@ Value* HIRBuilder::AddWithCarry(
return i->dest;
}
Value* HIRBuilder::VectorAdd(Value* value1, Value* value2, TypeName part_type,
uint32_t arithmetic_flags) {
ASSERT_VECTOR_TYPE(value1);
ASSERT_VECTOR_TYPE(value2);
// This is shady.
uint32_t flags = part_type | (arithmetic_flags << 8);
XEASSERTZERO(flags >> 16);
Instr* i = AppendInstr(
OPCODE_VECTOR_ADD_info, (uint16_t)flags,
AllocValue(value1->type));
i->set_src1(value1);
i->set_src2(value2);
i->src3.value = NULL;
return i->dest;
}
Value* HIRBuilder::Sub(
Value* value1, Value* value2, uint32_t arithmetic_flags) {
ASSERT_TYPES_EQUAL(value1, value2);