public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114100] New: [avr] Inefficient indirect addressing on Reduced Tiny
@ 2024-02-25 16:32 gjl at gcc dot gnu.org
  2024-02-25 16:33 ` [Bug target/114100] " gjl at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-02-25 16:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114100

            Bug ID: 114100
           Summary: [avr] Inefficient indirect addressing on Reduced Tiny
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

The Reduced Tiny core does not support indirect addressing with offset, which
basically means that every indirect memory access with a size of more than one
byte is effectively POST_INC or PRE_DEC.  The lack of that addressing mode is
currently handled by pretending to support it, and then let the insn printers
add and subtract again offsets as needed on the fly.

For example, the following C code

   int vars[10];

   void inc_var2 (void) {
      ++vars[2];
   }

is compiled to:

   ldi r30,lo8(vars)     ;  14   [c=4 l=2]  *movhi/4
   ldi r31,hi8(vars)
   subi r30,lo8(-(4))    ;  15   [c=8 l=6]  *movhi/2
   sbci r31,hi8(-(4))
   ld r20,Z+
   ld r21,Z
   subi r30,lo8((4+1))
   sbci r31,hi8((4+1))
   subi r20,-1             ;  16   [c=4 l=2]  *addhi3_clobber/1
   sbci r21,-1
   subi r30,lo8(-(4+1))    ;  17   [c=4 l=4]  *movhi/3
   sbci r31,hi8(-(4+1))
   st Z,r21
   st -Z,r20

where the code could be:

   ldi r30,lo8(vars+4)    ;  28   [c=4 l=2]  *movhi/4
   ldi r31,hi8(vars+4)
   ld r20,Z+              ;  17   [c=8 l=2]  *movhi/2
   ld r21,Z+
   subi r20,-1            ;  19   [c=4 l=2]  *addhi3_clobber/1
   sbci r21,-1
   st -Z,r21              ;  30   [c=4 l=2]  *movhi/3
   st -Z,r20

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-03 17:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-25 16:32 [Bug target/114100] New: [avr] Inefficient indirect addressing on Reduced Tiny gjl at gcc dot gnu.org
2024-02-25 16:33 ` [Bug target/114100] " gjl at gcc dot gnu.org
2024-02-25 19:29 ` pinskia at gcc dot gnu.org
2024-02-29 19:42 ` cvs-commit at gcc dot gnu.org
2024-03-01  9:15 ` gjl at gcc dot gnu.org
2024-03-02  9:21 ` cvs-commit at gcc dot gnu.org
2024-03-03 17:17 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).