[PATCH] [mips][ias] Make immediate zero synonymous with $zero when parsing registers.

Daniel Sanders daniel.sanders at imgtec.com
Fri Jan 30 10:50:02 PST 2015

> I'm not sure if we should do this.

>  This patch would make us accept very strange instructions, such as "add 0, $4, $4"

I hadn't thought of that one. I was thinking of things like 'addu $2, 0, $2' and instructions that don't have immediate forms.

I'm a little on the fence as to whether I agree it's strange or not. True, it's syntax that GAS doesn't accept but I like the way it suggests that the result is still zero after the instruction because constants don't change.

> and it does not address the root of the issue, which is the IAS' lack of a BNE+Imm macro instruction.

>  GAS has such a macro, so it doesn't complain about Ed's use case  (and also accepts any other immediates).


> If Ed thinks it would be useful for him to have his particular use case fixed sooner rather than later, then LGTM with the inlined changes.

>  Otherwise, I think doing a proper implementation of the BNE+Imm macro would be best (which we should do at some point either way).

You've also touched on another good reason to not do this patch there. If it generates different opcodes compared to the immediate forms of instructions then it will be harder to verify our assembler by comparing object files.



More information about the llvm-commits mailing list