]> Cypherpunks repositories - gostls13.git/commit
cmd/8l: fix misassembling of MOVB involving (AX)(BX*1)
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Thu, 31 Jan 2013 07:52:46 +0000 (08:52 +0100)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Thu, 31 Jan 2013 07:52:46 +0000 (08:52 +0100)
commit354a3a151337d8997f97a8dabfd6d85377c5270f
tree8254052bf9f06b0f0c31f98f3c90af0560695744
parent73b83a228e61045b76b758f6948df80f7e7e32cd
cmd/8l: fix misassembling of MOVB involving (AX)(BX*1)

The linker accepts MOVB involving non-byte-addressable
registers, by generating XCHG instructions to AX or BX.
It does not handle the case where nor AX nor BX are available.

See also revision 1470920a2804.

Assembling
    TEXT ·Truc(SB),7,$0
    MOVB BP, (BX)(AX*1)
    RET

gives before:
   08048c60 <main.Truc>:
    8048c60:       87 dd         xchg   %ebx,%ebp
    8048c62:       88 1c 03      mov    %bl,(%ebx,%eax,1)
    8048c65:       87 dd         xchg   %ebx,%ebp
    8048c67:       c3            ret

and after:
   08048c60 <main.Truc>:
    8048c60:       87 cd         xchg   %ecx,%ebp
    8048c62:       88 0c 03      mov    %cl,(%ebx,%eax,1)
    8048c65:       87 cd         xchg   %ecx,%ebp
    8048c67:       c3            ret

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7226066
src/cmd/8l/span.c