Re: [PATCH RFC 12/67] MIPS: asm: asmmacro: Replace add instructions with "addui"
From: Maciej W. Rozycki <hidden>
Date: 2015-01-11 23:34:13
On Fri, 19 Dec 2014, Markos Chandras wrote:
quoted
quoted
The use of "add" instruction for immediate operations is wrong and relies to gas being smart enough to notice that and replace it with either addi or addui. However, MIPS R6 removed the addi instruction so, fix this problem properly by using the correct instruction directly.
Not true, depending on the arguments the ADD assembly macro expands to either of the ADD and the ADDI hardware instructions; where an immediate outside the 16-bit signed range is used it also expands to a longer sequence involving LUI and the actual operation is ADD. It never expands to ADDIU (which I gather you meant).
quoted
This is another case of the use of "add" being a real bug. We should never have faulting instructions like this in the kernel. Can you send all patches in this set that fix this bug as a separate patch? Since they are obviously correct, and really should be used by all non-R6 processors, we can get them in sooner that the entire R6 thing. Thanks, David Daneysure i will move these patches away from R6 and post them separately.
I think using the ADDU macro is preferred here as it allows arbitrary 32-bit values for `off', just like with memory references in MIPS assembly instructions. Maciej