Fixing subfme.
This commit is contained in:
parent
3ba6598caf
commit
6fd7e35deb
|
@ -318,12 +318,19 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (i->dest->type == ca->type) {
|
||||
i->Replace(&OPCODE_ASSIGN_info, 0);
|
||||
i->set_src1(ca);
|
||||
if (ca->IsConstant()) {
|
||||
TypeName target_type = v->type;
|
||||
v->set_from(ca);
|
||||
v->ZeroExtend(target_type);
|
||||
i->Remove();
|
||||
} else {
|
||||
i->Replace(&OPCODE_ZERO_EXTEND_info, 0);
|
||||
i->set_src1(ca);
|
||||
if (i->dest->type == ca->type) {
|
||||
i->Replace(&OPCODE_ASSIGN_info, 0);
|
||||
i->set_src1(ca);
|
||||
} else {
|
||||
i->Replace(&OPCODE_ZERO_EXTEND_info, 0);
|
||||
i->set_src1(ca);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -404,6 +411,11 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder) {
|
|||
v->set_from(i->src1.value);
|
||||
v->Xor(i->src2.value);
|
||||
i->Remove();
|
||||
} else if (!i->src1.value->IsConstant() &&
|
||||
!i->src2.value->IsConstant() &&
|
||||
i->src1.value == i->src2.value) {
|
||||
v->set_zero(v->type);
|
||||
i->Remove();
|
||||
}
|
||||
break;
|
||||
case OPCODE_NOT:
|
||||
|
@ -478,7 +490,7 @@ void ConstantPropagationPass::PropagateCarry(Value* v, bool did_carry) {
|
|||
next = use->next;
|
||||
if (use->instr->opcode == &OPCODE_DID_CARRY_info) {
|
||||
// Replace carry value.
|
||||
use->instr->dest->set_constant(did_carry ? 1 : 0);
|
||||
use->instr->dest->set_constant(int8_t(did_carry ? 1 : 0));
|
||||
use->instr->Remove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -466,8 +466,9 @@ XEEMITTER(subfex, 0x7C000110, XO)(PPCHIRBuilder& f, InstrData& i) {
|
|||
|
||||
XEEMITTER(subfmex, 0x7C0001D0, XO)(PPCHIRBuilder& f, InstrData& i) {
|
||||
// RT <- ¬(RA) + CA - 1
|
||||
Value* v = f.AddWithCarry(f.Not(f.LoadGPR(i.XO.RA)),
|
||||
f.LoadConstant((int64_t)-1), f.LoadCA());
|
||||
Value* v =
|
||||
f.AddWithCarry(f.Not(f.LoadGPR(i.XO.RA)), f.LoadConstant((int64_t)-1),
|
||||
f.LoadCA(), ARITHMETIC_SET_CARRY);
|
||||
if (i.XO.OE) {
|
||||
assert_always();
|
||||
// e.update_xer_with_overflow_and_carry(b.CreateExtractValue(v, 1));
|
||||
|
|
|
@ -55,7 +55,7 @@ test_subfme_zero_ca_1:
|
|||
blr
|
||||
#_ REGISTER_OUT r10 0x00000000000103BF
|
||||
#_ REGISTER_OUT r3 0xfffffffffffefc3f
|
||||
#_ REGISTER_OUT r4 0
|
||||
#_ REGISTER_OUT r4 1
|
||||
|
||||
test_subfme_zero_ca_2:
|
||||
#_ REGISTER_IN r10 0
|
||||
|
@ -66,7 +66,7 @@ test_subfme_zero_ca_2:
|
|||
blr
|
||||
#_ REGISTER_OUT r10 0
|
||||
#_ REGISTER_OUT r3 0xfffffffffffffffe
|
||||
#_ REGISTER_OUT r4 0
|
||||
#_ REGISTER_OUT r4 1
|
||||
|
||||
test_subfme_zero_ca_3:
|
||||
#_ REGISTER_IN r10 1
|
||||
|
@ -77,7 +77,7 @@ test_subfme_zero_ca_3:
|
|||
blr
|
||||
#_ REGISTER_OUT r10 1
|
||||
#_ REGISTER_OUT r3 0xfffffffffffffffd
|
||||
#_ REGISTER_OUT r4 0
|
||||
#_ REGISTER_OUT r4 1
|
||||
|
||||
test_subfme_zero_ca_4:
|
||||
#_ REGISTER_IN r10 0xFFFFFFFFFFFFFFFF
|
||||
|
|
Loading…
Reference in New Issue