Summary: | [m68k] Suboptimal equality comparisons with small integers | ||
---|---|---|---|
Product: | gcc | Reporter: | Kazu Hirata <kazu> |
Component: | target | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | gcc-bugs, jeffreyalaw |
Priority: | P3 | Keywords: | missed-optimization |
Version: | 4.2.0 | ||
Target Milestone: | --- | ||
Host: | Target: | m68k-elf | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2005-11-28 05:02:38 | |
Bug Depends on: | 81613 | ||
Bug Blocks: |
Description
Kazu Hirata
2005-11-27 02:11:53 UTC
Confirmed. Note that due to the 2-address nature of the m68k, this transformation is only valid when both registers die. We need the register holding the immediate to die because the register will no longer be holding that immediate. We need the register we're comparing against the immediate to die because we're going to change its value. Finally the register we're comparing against the immediate must be a data register otherwise addq/subq will not set the condition codes. It essentially needs to be a 3 insn -> 3 insn peephole2. The key realization is that we're going to depend on test elimination in final to eliminate the comparison. The peep2 just makes it painfully obvious to final how to do that. Patch nearly ready... Author: law Date: Fri Nov 18 21:52:32 2016 New Revision: 242605 URL: https://gcc.gnu.org/viewcvs?rev=242605&root=gcc&view=rev Log: PR target/25112 * config/m68k/m68k.c (moveq feeding equality comparison): New peepholes. * config/m68k/predicates.md (addq_subq_operand): New predicate. (equality_comparison_operator): Likewise. PR target/25112 * gcc.target/m68k/pr25112: New test. Added: trunk/gcc/testsuite/gcc.target/m68k/pr25112.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/m68k/m68k.md trunk/gcc/config/m68k/predicates.md trunk/gcc/testsuite/ChangeLog Fixed on the trunk for gcc-7. |