https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111670
Bug ID: 111670 Summary: H8/300 SX uses incorrect code sequences Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: law at gcc dot gnu.org Target Milestone: --- The H8/SX port can create sequences like (set (mem (autoinc (reg sp)) (reg_sp)) Here autoinc is PRE_DECEMENT or PRE_INCREMENT addressing modes. Which is invalid RTL. I believe this is the root cause of the following H8/SX failures in the testsuite: h8300-sim/-msx/-mint32: gcc.c-torture/execute/920501-6.c -O1 execution test h8300-sim/-msx/-mint32: gcc.c-torture/execute/920501-6.c -Os execution test h8300-sim/-msx/-mint32: gcc.c-torture/execute/pr20466-1.c -O1 execution test h8300-sim/-msx/-mint32: gcc.c-torture/execute/pr20466-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test h8300-sim/-msx/-mint32: gcc.c-torture/execute/pr20466-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test h8300-sim/-msx/-mint32: gcc.c-torture/execute/pr39339.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test h8300-sim/-msx/-mint32: gcc.c-torture/execute/ssad-run.c -O1 execution test h8300-sim/-msx/-mint32: gcc.c-torture/execute/ssad-run.c -Os execution test h8300-sim/-msx/-mint32: gcc.c-torture/execute/usad-run.c -O1 execution test h8300-sim/-msx/-mint32: gcc.c-torture/execute/usad-run.c -Os execution test I suspect we need to break the "Q" constraint into two variants. One which allows autoinc addressing modes and the other does not. For movsi/movhi we would use the version which does not allow autoinc addressing modes and instead use the Z0/ZA approach like the other H8 variants are using. I'm not currently working on this.