[avr,applied] PR114794 - Tweak divmodqi4

Message ID 8f6ef995-eb60-4a24-b0f4-8f7e326a55cd@gjlay.de
State New
Headers
Series [avr,applied] PR114794 - Tweak divmodqi4 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply

Commit Message

Georg-Johann Lay April 21, 2024, 12:39 p.m. UTC
  Instead of jumping to a place that ROLs r_arg1 (with C=0),
LSL r_arg1 can be performed prior to the loop.  This
reduces the number of loopings from 9 to 8.

Applied as obvious.

Johann

AVR: target/114794 - Tweak __udivmodqi4

libgcc/
         PR target/114794
         * config/avr/lib1funcs.S (__udivmodqi4): Tweak.
  

Patch

diff --git a/libgcc/config/avr/lib1funcs.S b/libgcc/config/avr/lib1funcs.S
index 535510ab867..af4d7d97016 100644
--- a/libgcc/config/avr/lib1funcs.S
+++ b/libgcc/config/avr/lib1funcs.S
@@ -1339,9 +1339,9 @@  DEFUN __umulsidi3

  #if defined (L_udivmodqi4)
  DEFUN __udivmodqi4
-       sub     r_rem,r_rem     ; clear remainder and carry
-       ldi     r_cnt,9         ; init loop counter
-       rjmp    __udivmodqi4_ep ; jump to entry point
+       clr     r_rem           ; clear remainder
+       ldi     r_cnt,8         ; init loop counter
+       lsl     r_arg1          ; shift dividend
  __udivmodqi4_loop:
         rol     r_rem           ; shift dividend into remainder
         cp      r_rem,r_arg2    ; compare remainder & divisor