[PATCH] D138529: [AVR] Optimize constant 32-bit shifts

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 02:33:28 PST 2022


benshi001 added inline comments.


================
Comment at: llvm/lib/Target/AVR/AVRISelLowering.cpp:1866
+    Register Zero = MRI.createVirtualRegister(&AVR::GPR8RegClass);
+    BuildMI(*BB, MI, dl, TII.get(AVR::COPY), Zero).addReg(AVR::R1);
+
----------------
How about using GetZeroRegister() instead of fixed AVR::R1? This way should also fit avrtiny. Or we can emit eor Rx, Rx instead of mov Rx, Zero .


================
Comment at: llvm/lib/Target/AVR/AVRISelLowering.cpp:1919
+      ExtMore = MRI.createVirtualRegister(&AVR::GPR8RegClass);
+      BuildMI(*BB, MI, dl, TII.get(AVR::COPY), ExtMore).addReg(AVR::R1);
+      // Rotate most significant bit into a new register (that starts out zero).
----------------
How about using GetZeroRegister() instead of fixed AVR::R1? This way should also fit avrtiny. Or we can emit eor Rx, Rx instead of mov Rx, Zero .


================
Comment at: llvm/lib/Target/AVR/AVRISelLowering.cpp:1990
+      } else {
+        BuildMI(*BB, MI, dl, TII.get(AVR::COPY), ShrExtendReg).addReg(AVR::R1);
+      }
----------------
How about using GetZeroRegister() instead of fixed AVR::R1? This way should also fit avrtiny. Or we can emit eor Rx, Rx instead of mov Rx, Zero .


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138529/new/

https://reviews.llvm.org/D138529



More information about the llvm-commits mailing list