Fixing mtcr -- needs some tests.

This commit is contained in:
Ben Vanik 2015-02-11 01:10:30 -08:00
parent d1f1fa8951
commit 211af0b2c6
1 changed files with 8 additions and 4 deletions

View File

@ -301,13 +301,17 @@ void PPCHIRBuilder::StoreCR(uint32_t n, Value* value) {
// Pull out the bits we are interested in.
// Optimization passes will kill any unneeded stores (mostly).
StoreContext(offsetof(PPCContext, cr0) + (4 * n) + 0,
Truncate(Shr(value, 4 * (7 - n) + 3), INT8_TYPE));
And(Truncate(Shr(value, 4 * (7 - n) + 3), INT8_TYPE),
LoadConstant(uint8_t(1))));
StoreContext(offsetof(PPCContext, cr0) + (4 * n) + 1,
Truncate(Shr(value, 4 * (7 - n) + 2), INT8_TYPE));
And(Truncate(Shr(value, 4 * (7 - n) + 2), INT8_TYPE),
LoadConstant(uint8_t(1))));
StoreContext(offsetof(PPCContext, cr0) + (4 * n) + 2,
Truncate(Shr(value, 4 * (7 - n) + 1), INT8_TYPE));
And(Truncate(Shr(value, 4 * (7 - n) + 1), INT8_TYPE),
LoadConstant(uint8_t(1))));
StoreContext(offsetof(PPCContext, cr0) + (4 * n) + 3,
Truncate(Shr(value, 4 * (7 - n) + 0), INT8_TYPE));
And(Truncate(Shr(value, 4 * (7 - n) + 0), INT8_TYPE),
LoadConstant(uint8_t(1))));
}
void PPCHIRBuilder::StoreCRField(uint32_t n, uint32_t bit, Value* value) {