4ad / go.arm64

Go development tree for the arm64 port (historical).
BSD 3-Clause "New" or "Revised" License
17 stars 3 forks source link

liblink: MOV ZR, Rn considered harmful #106

Open davecheney opened 9 years ago

davecheney commented 9 years ago

The use of MOV ZR, R0 caused runtime.usleep to barf. Spelling out the zeroing of the those registers fixed it, 26722042.

I guess we should avoid using ZR anywhere for the moment.

davecheney commented 9 years ago

The following code

// pselect6(0, 0, 0, 0, &ts, 0)
MOV $0, R0
MOV R0, R1
MOV R0, R2
MOV R0, R3
ADD $8, SP, R4
MOV R0, R5

assembles to

   0x0000000000121d94 <+36>:    mov     x0, #0x0                        // #0
   0x0000000000121d98 <+40>:    mov     x1, x0
   0x0000000000121d9c <+44>:    mov     x2, x0
   0x0000000000121da0 <+48>:    mov     x3, x0
   0x0000000000121da4 <+52>:    add     x4, sp, #0x8
   0x0000000000121da8 <+56>:    mov     x5, x0

however, using ZR

// pselect6(0, 0, 0, 0, &ts, 0)
MOV ZR, R0
MOV ZR, R1
MOV ZR, R2
MOV ZR, R3
ADD $8, SP, R4
MOV ZR, R5

assembles to

   0x0000000000121d94 <+36>:    mov     x0, sp
   0x0000000000121d98 <+40>:    mov     x1, sp
   0x0000000000121d9c <+44>:    mov     x2, sp
   0x0000000000121da0 <+48>:    mov     x3, sp
   0x0000000000121da4 <+52>:    add     x4, sp, #0x8
   0x0000000000121da8 <+56>:    mov     x5, sp

sad trombone sad-trombone-o