In this case, we're supposed to load the immediate in AT and then ADDu it with the source register and put it in the destination register.
Details
Diff Detail
Event Timeline
lib/Target/Mips/AsmParser/MipsAsmParser.cpp | ||
---|---|---|
1777–1778 | There's no need for UseAT. It's equivalent to ATReg == 0 | |
1823 | The 'UseAT ? ATReg : DstReg' is repeated a number of times. Please use a variable to represent the temporary register. | |
test/MC/Mips/mips-expansions.s | ||
46 | I think this should be: addiu $8, $8, 20 |
LGTM with a nit
lib/Target/Mips/AsmParser/MipsAsmParser.cpp | ||
---|---|---|
1785 | Nit: We don't need to use ATReg again so you can fold that ternary operator into the control flow above. | |
test/MC/Mips/mips-expansions.s | ||
46 | I'd forgotten about that, thanks for reminding me. It's not exactly a bug. If I remember my conversation with Matthew correctly, there was some benefit to favoring addiu in the really old CPU's but that benefit no longer applies to anything in use today. |
Rebased.
Daniel, is shortening IntermediateDstReg to TmpReg OK with you ?
You pointed that out in private, but since I ended up making the change, your position should be included in the public review.
LGTM
Daniel, is shortening IntermediateDstReg to TmpReg OK with you ?
You pointed that out in private, but since I ended up making the change, your position should be included in the public review.
I didn't mind either way. When we spoke, I was making a general comment that descriptive names are generally good but short, non-descriptive names aren't always bad. The obvious example is 'i', and 'j' for loop counters. Personally, I use TmpReg for trivial scratch registers and use more descriptive names when there are several of them (otherwise it starts to get confusing).
There's no need for UseAT. It's equivalent to ATReg == 0