Hi, On Tue, 2024-01-16 at 21:02 +0100, stefan@xxxxxxxxx wrote: > Hi all, > > > > I work a lot with the good old m68k target where post-increment is supported, and I was surprised that there almost no post-increments are used in the generated code. > > This simple code: > > > > void memclr (int length, long * ptr) { > > for(;length--;){ > > *ptr++= 0; > > } > > } > > > > does not use post-increments on AVR or SH. See also https://godbolt.org/z/fTvdv65rr > > This issue has been around for a very long time. I guess auto-inc is not important enough on modern architectures to be of a major concern. On SH{1,2,3,4} post-inc is only available for mem stores, not for mem loads. SH2A adds support for stores with post-inc. You have to specify "-mb -m2a" for that, as the default target of sh-elf is SH1 (-m1). But yeah, it's also not utilized in this case. Cheers, Oleg