https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55190
--- Comment #12 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #0)
> The following code:
>
> struct X
> {
> int a, b, c, d, e;
> };
>
> int test (X* x, unsigned int c)
> {
> int s = 0;
> unsigned int i;
> for (i = 0; i < c; ++i)
> s += x[i].b;
> return s;
> }
>
> results in:
> tst r5,r5
> bt/s .L4
> mov r5,r1
> shll2 r1
> add r5,r1
> mov.l .L9,r2
> shll2 r1
> add #-20,r1
> shlr2 r1
> mul.l r2,r1
> mov.l .L10,r2
> add #4,r4
> mov #0,r0
> sts macl,r1
> and r2,r1
> add #1,r1
> .L3:
> mov.l @r4,r2
> dt r1
> add #20,r4
> bf/s .L3
> add r2,r0
> rts
> nop
> .L4:
> rts
> mov #0,r0
> .L11:
> .align 2
> .L9:
> .long 214748365
> .L10:
> .long 1073741823
>
As of GCC 13, this still produces the same code with loop header bloat.