|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
Re: Still problems.On Jun 17, 2008, at 3:34 AM, Paolo Bonzini wrote:
-- Laurent _______________________________________________ Lightning mailing list Lightning@... http://lists.gnu.org/mailman/listinfo/lightning |
|
|
Re: Still problems.I tried the patch. The call goes through, but I'm afraid something else is interfering. The code fragment:
_code->getarg_p(CJIT_V0, ofs4); _code->ldxi_l(CJIT_R0,CJIT_V2,LocRuntime::offsetOfST()); _code->ldxi_l(CJIT_R1,CJIT_R0,LocRTStackI::offsetOfMX()); _code->ldxi_l(CJIT_R2,CJIT_R0,LocRTStackI::offsetOfST()); _code->muli_l(CJIT_R1,CJIT_R1,sizeof(ColSlotI)); Now generates: 0x1000300002: mov %rcx,%rbx 0x1000300005: mov 0x48(%r13),%rax 0x1000300009: mov 0x8(%rax),%r10 0x100030000d: mov 0x10(%rax),%r11 0x1000300011: imul $0x10,%r10,%rdx The last instruction is of interest. It should be R1 <- R1 * $0x10. Now it somehow gets translated into a write into RDX rather than into R10. I checked the macro in core-64.h #define jit_muli_l(d, rs, is) jit_op_ ((d), (rs), IMULQir((is), (d)) ) and it looks fine. The jit_op_ looks fine too: /* 3-parameter operation, with immediate */ #define jit_op_(d, s1, op2d) \ ((s1 == d) ? op2d : (MOVLrr(s1, d), op2d)) I double checked and the first arguments to the macro are indeed equal and equal to 0x4A (R10). Here is the relevant macro. Both references to RD use the same masking #define IMULQir(IM, RD) (_REXQrr(0, RD), _Os_Mrm_sL (0x69 ,_b11,_r8(RD),_r8(RD) ,IM )) The _r8(RD) macro tests RD to decide how to mask it and it appears that it elects to use _r4(RD) for its encoding. Which produces: (gdb) p /t CJIT_R1 & 0x07 $19 = 10 I checked how RDX would be masked and of course I get: (gdb) p /t 0x52 & 0x07 $20 = 10 So it would sound like R10 is not really a GPR. It cannot appear anywhere ? Either that is the case, or the instruction should use _r4 to encode the destination register. I'll try to get the intel spec to check, but I thought I'd report now anyhow. On Jun 17, 2008, at 3:34 AM, Paolo Bonzini wrote:
-- Laurent _______________________________________________ Lightning mailing list Lightning@... http://lists.gnu.org/mailman/listinfo/lightning |
|
|
Re: Still problems.> #define IMULQir(IM, RD) (_REXQrr(0, RD), _Os_Mrm_sL (0x69 > ,_b11,_r8(RD),_r8(RD) ,IM )) I tried assembling two instructions and got; 0: 4d 6b d2 0a imul $0xa,%r10,%r10 4: 49 6b d2 0a imul $0xa,%r10,%rdx I think the _REXQrr arguments should be "RD, RD". Paolo _______________________________________________ Lightning mailing list Lightning@... http://lists.gnu.org/mailman/listinfo/lightning |
|
|
Re: Still problems.> Here is the relevant macro. Both references to RD use the same masking > > #define IMULQir(IM, RD) (_REXQrr(0, RD), _Os_Mrm_sL (0x69 > ,_b11,_r8(RD),_r8(RD) ,IM )) Even better, as the disassembly suggests: #define IMULQir(IM, RD) IMULQir(IM, (RD), (RD)) There seem to be other problems in the encoding of the REX bits though. Paolo _______________________________________________ Lightning mailing list Lightning@... http://lists.gnu.org/mailman/listinfo/lightning |
|
|
Re: Still problems.> Here is the relevant macro. Both references to RD use the same masking > > #define IMULQir(IM, RD) (_REXQrr(0, RD), _Os_Mrm_sL (0x69 > ,_b11,_r8(RD),_r8(RD) ,IM )) As Murphy's law goes, the only wrong ones were IMULQir and IMULQirr--checked against as+objdump with the following assembly source code (stuff after # is a comment): movq %r10, %rdx #define MOVQrr(RS, RD) (_REXQrr(RS, RD) testq %r10, %rdx #define TESTQrr(RS, RD) (_REXQrr(RS, RD) cmpxchgq %r10, %rdx #define CMPXCHGQrr(RS, RD) (_REXQrr(RS, RD) xaddq %r10, %rdx #define XADDQrr(RS, RD) (_REXQrr(RS, RD) xchgq %r10, %rdx #define XCHGQrr(RS, RD) (_REXQrr(RS, RD) imulq %r10, %rdx #define IMULQrr(RS, RD) (_REXQrr(RD, RS) imulq $10, %r10, %rdx #define IMULQirr(IM,RS,RD) (_REXQrr(RS, RD) <<< WRONG! cmovbq %r10, %rdx #define CMOVQrr(CC,RS,RD) (_REXQrr(RD, RS) bsfq %r10, %rdx #define BSFQrr(RS, RD) (_REXQrr(RD, RS) bsrq %r10, %rdx #define BSRQrr(RS, RD) (_REXQrr(RD, RS) movsbq %r10b, %rdx #define MOVSBQrr(RS, RD) (_REXQrr(RD, RS) movzbq %r10b, %rdx #define MOVZBQrr(RS, RD) (_REXQrr(RD, RS) movswq %r10w, %rdx #define MOVSWQrr(RS, RD) (_REXQrr(RD, RS) movzwq %r10w, %rdx #define MOVZWQrr(RS, RD) (_REXQrr(RD, RS) movslq %r10d, %rdx #define MOVSLQrr(RS, RD) _m64only((_REXQrr(RD, RS) Fix committed & pushed. Paolo _______________________________________________ Lightning mailing list Lightning@... http://lists.gnu.org/mailman/listinfo/lightning |
|
|
Re: Re: Still problems.You're the King ;-)
Thanks! --- Laurent On Jun 17, 2008, at 9:25 AM, Paolo Bonzini wrote: > >> Here is the relevant macro. Both references to RD use the same >> masking >> #define IMULQir(IM, RD) (_REXQrr(0, RD), _Os_Mrm_sL >> (0x69 ,_b11,_r8(RD),_r8(RD) ,IM )) > > As Murphy's law goes, the only wrong ones were IMULQir and IMULQirr-- > checked against as+objdump with the following assembly source code > (stuff after # is a comment): > > movq %r10, %rdx #define MOVQrr(RS, RD) (_REXQrr(RS, RD) > testq %r10, %rdx #define TESTQrr(RS, RD) (_REXQrr(RS, RD) > cmpxchgq %r10, %rdx #define CMPXCHGQrr(RS, RD) (_REXQrr(RS, RD) > xaddq %r10, %rdx #define XADDQrr(RS, RD) (_REXQrr(RS, RD) > xchgq %r10, %rdx #define XCHGQrr(RS, RD) (_REXQrr(RS, RD) > > imulq %r10, %rdx #define IMULQrr(RS, RD) (_REXQrr(RD, RS) > imulq $10, %r10, %rdx #define IMULQirr(IM,RS,RD) (_REXQrr(RS, RD) > <<< WRONG! > cmovbq %r10, %rdx #define CMOVQrr(CC,RS,RD) (_REXQrr(RD, RS) > bsfq %r10, %rdx #define BSFQrr(RS, RD) (_REXQrr(RD, RS) > bsrq %r10, %rdx #define BSRQrr(RS, RD) (_REXQrr(RD, RS) > movsbq %r10b, %rdx #define MOVSBQrr(RS, RD) (_REXQrr(RD, RS) > movzbq %r10b, %rdx #define MOVZBQrr(RS, RD) (_REXQrr(RD, RS) > movswq %r10w, %rdx #define MOVSWQrr(RS, RD) (_REXQrr(RD, RS) > movzwq %r10w, %rdx #define MOVZWQrr(RS, RD) (_REXQrr(RD, RS) > movslq %r10d, %rdx #define MOVSLQrr(RS, RD) > _m64only((_REXQrr(RD, RS) > > Fix committed & pushed. > > Paolo > > > _______________________________________________ > Lightning mailing list > Lightning@... > http://lists.gnu.org/mailman/listinfo/lightning Laurent _______________________________________________ Lightning mailing list Lightning@... http://lists.gnu.org/mailman/listinfo/lightning |
| Free embeddable forum powered by Nabble | Forum Help |