-
Notifications
You must be signed in to change notification settings - Fork 5.4k
ZJIT: Split shift with immediate operand #13914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6a97041
to
e365f99
Compare
def test(n) = C * n | ||
test(4) | ||
test(4) | ||
test(4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does the script generate the URShift
instruction and is it possible to see it in dumped HIR output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's only in LIR; it's a shift for untagging
Optimized HIR:
fn test@testshift.rb:4:
bb0(v0:BasicObject, v1:BasicObject):
PatchPoint SingleRactorMode
PatchPoint StableConstantNames(0x600001b86020, RP2A03_CC)
v10:Fixnum[12] = Const Value(12)
PatchPoint BOPRedefined(INTEGER_REDEFINED_OP_FLAG, BOP_MULT)
v13:Fixnum = GuardType v1, Fixnum
v14:Fixnum = FixnumMult v10, v13
Return v14
LIR:
fn test:
Assembler
000 Label() target=Label(Label(0)) -> None
001 FrameSetup() -> None
002 LiveReg(A64Reg { num_bits: 64, reg_no: 0 }) -> VReg(0)
003 LiveReg(A64Reg { num_bits: 64, reg_no: 1 }) -> VReg(1)
004 PatchPoint(VReg(1)) target=SideExit { pc: 0x600000cbae00, stack: [], locals: [VReg(1)], c_stack_bytes: 0, reason: PatchPoint(SingleRactorMode), label: Some(Label(1)) } -> None
005 PosMarker() -> None
006 PatchPoint(VReg(1)) target=SideExit { pc: 0x600000cbae00, stack: [], locals: [VReg(1)], c_stack_bytes: 0, reason: PatchPoint(StableConstantNames { idlist: 0x600001b86020 }), label: Some(Label(2)) } -> None
007 PosMarker() -> None
008 PatchPoint(Value(VALUE(25)), VReg(1), VReg(1)) target=SideExit { pc: 0x600000cbae20, stack: [Value(VALUE(25)), VReg(1)], locals: [VReg(1)], c_stack_bytes: 0, reason: PatchPoint(BOPRedefined { klass: 1, bop: 2 }), label: Some(Label(3)) } -> None
009 PosMarker() -> None
010 Test(VReg(1), 1_u64) -> None
011 Jz(Value(VALUE(25)), VReg(1), VReg(1)) target=SideExit { pc: 0x600000cbae20, stack: [Value(VALUE(25)), VReg(1)], locals: [VReg(1)], c_stack_bytes: 0, reason: GuardType(Type { bits: 4194304, spec: Any }), label: None } -> None
012 RShift(Value(VALUE(25)), 1_u64) -> VReg(2)
013 Sub(VReg(1), 1_u64) -> VReg(3)
014 Mul(VReg(2), VReg(3)) -> VReg(4)
015 JoMul(Value(VALUE(25)), VReg(1), VReg(1)) target=SideExit { pc: 0x600000cbae20, stack: [Value(VALUE(25)), VReg(1)], locals: [VReg(1)], c_stack_bytes: 0, reason: FixnumMultOverflow, label: None } -> None
016 Add(VReg(4), 1_u64) -> VReg(5)
017 Add(A64Reg { num_bits: 64, reg_no: 19 }, 38_u64) -> VReg(6)
018 Mov(A64Reg { num_bits: 64, reg_no: 19 }, VReg(6)) -> None
019 Mov(Mem64[Reg(20) + 16], A64Reg { num_bits: 64, reg_no: 19 }) -> None
020 FrameTeardown() -> None
021 CRet(VReg(5)) -> None
022 PadPatchPoint() -> None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry I'm blind on the file name 🤦
Will need a fix on x86 as well 😢 |
Fix Shopify#627