RESOLVED FIXED 231159
[JSC][ARMv7] Improve instruction selection in MacroAssembler
https://bugs.webkit.org/show_bug.cgi?id=231159
Summary [JSC][ARMv7] Improve instruction selection in MacroAssembler
Geza Lore
Reported 2021-10-04 02:29:12 PDT
I have spotted some improvement opportunities in MacroAssemblerARMv7 for better instruction selection for some macros. What shows up most often in the disassembly ('ip' is 'r12'): mvn ip, #8 and r0, r0, ip This is an 8-byte sequence which is equivalent to the following 2-byte instruction: bic r0, #8 similarly: mvn ip, #7 add r0, r0, ip should be: sub r0, r0, #8 A review of the disassembly would likely yield more examples of similar sequences where an immediate can be encoded cheaper using an alternative instruction.
Attachments
Guillaume Emont
Comment 1 2021-10-06 08:53:32 PDT
(In reply to Geza Lore from comment #0) > I have spotted some improvement opportunities in MacroAssemblerARMv7 for > better instruction selection for some macros. What shows up most often in > the disassembly ('ip' is 'r12'): > > mvn ip, #8 > and r0, r0, ip > > This is an 8-byte sequence which is equivalent to the following 2-byte > instruction: > > bic r0, #8 > > > similarly: > > mvn ip, #7 > add r0, r0, ip > > should be: > > sub r0, r0, #8 > > A review of the disassembly would likely yield more examples of similar > sequences where an immediate can be encoded cheaper using an alternative > instruction. Would any of this change the minimal version of the instruction set that we support? (not that I have it very clear in my mind what is our minimum currently).
Geza Lore
Comment 2 2021-10-06 09:32:00 PDT
Not these. BIC and SUB are as old as AND and ADD.
Radar WebKit Bug Importer
Comment 3 2021-10-11 02:30:20 PDT
Geza Lore
Comment 4 2021-11-30 07:21:03 PST
Note https://bugs.webkit.org/show_bug.cgi?id=233474 implements the most frequent case of the mentioned add/sub exchange.
Geza Lore
Comment 5 2022-03-24 03:34:21 PDT
These have now been implemented in various patches
Note You need to log in before you can comment on or make changes to this bug.