Repository navigation
Encode rotated immediates in arm32 data processing instructions ##arch - #27140
HuzaifaChaudary wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
c3178e0 to
a8aeac9
Compare
|
The encoding fix looks good. Reusing Please rebase on current master and resolve the conflicts. One tiny fix while you're here: use Separate follow-ups, already broken before this PR:
No broader rewrite needed for this fix. |
|
Ping |
|
i did the changes and pushed to master in your name |
|
thanks for finishing it and landing it , and sorry i missed the ping . |
Description
arm32 data processing instructions with an immediate above 255 were assembled with the wrong constant , without an error :
adc r11, r0, 61341696adc r11, r0, #0eab7a0e2adcmi r11, lr, 984adcmi r11, lr, #216f6bfae42orreq r3, r3, 0x80000000orreq r3, r3, #002318303eor r0, r0, 0x101eor r0, r0, #1TYPE_ARIonly searched for a rotation when the value was a power of two , and every other value went through(imm << 24) | 2, which keeps the low 8 bits .0x80000000did not even reach the search , as anintit is negative . themovpath already hadgetimmed8, which tries every even rotation and setserrwhen there is none , soadd,adc,sub,sbc,rsb,rsc,and,orr,eorandbic, and thesforms the table has , use it too now . a value with no 8 bit rotated form is refused , as llvm-mc and gas do .found by decoding random words with llvm-mc (
-triple=armv7) , assembling the text withrasm2 -a arm -b 32and decoding the result again . same as llvm went from 618 to 764 of 3459 , nothing that was right changed , and the set that does not assemble is the same . the 7 new lines indb/asm/arm_32and the new test indb/tools/rasm2fail before the change , 3 lines that were marked broken inarm_32(andeq r3, r5, 0x80000000and the twoorreq r3, r3ones ) pass now and are unmarked .db/asmhas no failures .this touches a different part of
armass.cthan #27137 , they do not conflict .