mirror of
https://github.com/FEX-Emu/FEX.git
synced 2024-12-15 09:59:28 +00:00
OpcodeDispatcher: add and use AndConst
this skips the constant folding, which saves the branching in the rotate immediate implementations. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
parent
974baca09c
commit
34fdb14da1
@ -2524,7 +2524,7 @@ void OpDispatchBuilder::RCRSmallerOp(OpcodeArgs) {
|
||||
|
||||
// x86 masks the shift by 0x3F or 0x1F depending on size of op
|
||||
OrderedNode *Src = LoadSource(GPRClass, Op, Op->Src[1], Op->Flags, {.AllowUpperGarbage = true});
|
||||
Src = _And(OpSize::i32Bit, Src, _Constant(Size, 0x1F));
|
||||
Src = AndConst(OpSize::i32Bit, Src, 0x1F);
|
||||
|
||||
// CF only changes if we actually shifted. OF undefined if we didn't shift.
|
||||
// The result is unchanged if we didn't shift. So branch over the whole thing.
|
||||
@ -2723,7 +2723,7 @@ void OpDispatchBuilder::RCLSmallerOp(OpcodeArgs) {
|
||||
|
||||
// x86 masks the shift by 0x3F or 0x1F depending on size of op
|
||||
OrderedNode *Src = LoadSource(GPRClass, Op, Op->Src[1], Op->Flags, {.AllowUpperGarbage = true});
|
||||
Src = _And(OpSize::i32Bit, Src, _Constant(Size, 0x1F));
|
||||
Src = AndConst(OpSize::i32Bit, Src, 0x1F);
|
||||
|
||||
// CF only changes if we actually shifted. OF undefined if we didn't shift.
|
||||
// The result is unchanged if we didn't shift. So branch over the whole thing.
|
||||
|
@ -2130,6 +2130,16 @@ private:
|
||||
};
|
||||
}
|
||||
|
||||
OrderedNode *AndConst(FEXCore::IR::OpSize Size, OrderedNode *Node, uint64_t Const) {
|
||||
uint64_t NodeConst;
|
||||
|
||||
if (IsValueConstant(WrapNode(Node), &NodeConst)) {
|
||||
return _Constant(NodeConst & Const);
|
||||
} else {
|
||||
return _And(Size, Node, _Constant(Const));
|
||||
}
|
||||
}
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user