https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106167
Bug ID: 106167
Summary: Missed optimization (memory vs register read)
Product: gcc
Version: 9.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106161
--- Comment #3 from Victor Luchitz ---
Compilation flags used: -c -std=c11 -g -m2 -mb -Os -fomit-frame-pointer -Wall
-Wextra -pedantic -Wno-unused-parameter -Wimplicit-fallthrough=0
-Wno-missing-field-initializers -Wnonnull
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106161
--- Comment #2 from Victor Luchitz ---
Created attachment 53234
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53234=edit
Test case
Minimal test case.
You can see in the disassembly the same pattern as described in the original
report.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106161
Bug ID: 106161
Summary: Dubious choice of optimization strategy
Product: gcc
Version: 9.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100163
--- Comment #2 from Victor Luchitz ---
Here's relevant -S output for -O2:
...
sub r1,r15
.align 2
.L186:
mov.w @r2,r0
extu.w r0,r4
And for -O2 -fno-align-loops:
...
sub r1,r15
.L186:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100163
Bug ID: 100163
Summary: -falign-loops sometimes produces invalid code for SH-2
Product: gcc
Version: 9.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3