4ad/go.arm64

liblink: CMP ZR, Rn must be illegal

davecheney opened this issue · 5 comments

This form is illegal, it is indistinguishable from CMP SP, Rn.

I think that we now have two different words to describe ZR and SP, so is it possible to detect CMP ZR, Rn and abort ?

fwiw. CMP ZR, Rn, should be CMP $0, Rn, the immediate form

you are of course correct, but this is the only occurence where XSP and XZR
are present, and even then XZR forces the assembler to use the CMP Rn, imm
form.

On Wed, Mar 4, 2015 at 4:34 PM, Minux Ma notifications@github.com wrote:

It is actually possible to encode CMP XSP, XZR
and also CMP XSP, $0
(These are in the original arm operand order.)


Reply to this email directly or view it on GitHub
https://github.com/4ad/go/issues/143#issuecomment-77099877.

4ad commented

This seems to work just fine.

CMP ZR, R1 works and uses ZR.

CMP R1, ZR bails out.

On Wed, Mar 4, 2015 at 7:30 PM, Aram Hăvărneanu notifications@github.com
wrote:

This seems to work just fine.

CMP ZR, R1 works and uses ZR.

From my reading of the arm8 manual this afternoon, if you want to do CMP
Rn, ZR, you cant', y0ou have to use the CMP Rn, imm form with an immediate
zero.

If you want to do CMP ZR, Rn, that isn't the immediate form, it's the
extended register form, but that also means you can't write CMP SP, Rn.
Which is fine by me.

CMP R1, ZR bails out.


Reply to this email directly or view it on GitHub
https://github.com/4ad/go/issues/143#issuecomment-77115986.