public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113744] New: Unnecessary "m" constraint in *adddi_4
@ 2024-02-03 14:58 hjl.tools at gmail dot com
2024-02-03 15:00 ` [Bug target/113744] " hjl.tools at gmail dot com
2024-02-04 3:06 ` liuhongt at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2024-02-03 14:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113744
Bug ID: 113744
Summary: Unnecessary "m" constraint in *adddi_4
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
CC: crazylht at gmail dot com, hongyuw at gcc dot gnu.org,
lingling.kong7 at gmail dot com
Target Milestone: ---
commit 7abcef725e40589553a079df9258ae094b811751
Author: Kong Lingling <lingling.kong@intel.com>
Date: Wed Jan 18 17:23:29 2023 +0800
[APX NDD] Support APX NDD for optimization patterns of add
has
@@ -6994,31 +7021,35 @@ (define_insn "*addsi_3_zext"
(define_insn "*adddi_4"
[(set (reg FLAGS_REG)
(compare
- (match_operand:DI 1 "nonimmediate_operand" "0")
- (match_operand:DI 2 "x86_64_immediate_operand" "e")))
- (clobber (match_scratch:DI 0 "=r"))]
+ (match_operand:DI 1 "nonimmediate_operand" "0,rm")
+ (match_operand:DI 2 "x86_64_immediate_operand" "e,e")))
+ (clobber (match_scratch:DI 0 "=r,r"))]
"TARGET_64BIT
&& ix86_match_ccmode (insn, CCGCmode)"
But peephole which generates *adddi_4 only supports register as operand 2.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/113744] Unnecessary "m" constraint in *adddi_4
2024-02-03 14:58 [Bug target/113744] New: Unnecessary "m" constraint in *adddi_4 hjl.tools at gmail dot com
@ 2024-02-03 15:00 ` hjl.tools at gmail dot com
2024-02-04 3:06 ` liuhongt at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2024-02-03 15:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113744
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Other *add patterns may have the same issue.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/113744] Unnecessary "m" constraint in *adddi_4
2024-02-03 14:58 [Bug target/113744] New: Unnecessary "m" constraint in *adddi_4 hjl.tools at gmail dot com
2024-02-03 15:00 ` [Bug target/113744] " hjl.tools at gmail dot com
@ 2024-02-04 3:06 ` liuhongt at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2024-02-04 3:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113744
Hongtao Liu <liuhongt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |liuhongt at gcc dot gnu.org
--- Comment #2 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
7018; For comparisons against 1, -1 and 128, we may generate better code
7019; by converting cmp to add, inc or dec as done by peephole2. This pattern
7020; is matched then. We can't accept general immediate, because for
7021; case of overflows, the result is messed up.
7022; Also carry flag is reversed compared to cmp, so this conversion is valid
7023; only for comparisons not depending on it.
7024
It sounds to me those peephole2 can be extended to memory operand since APX_NDD
supports that. So it's not redudant m constraint in the pattern, but miss
optimization in those peepholes.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-04 3:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-03 14:58 [Bug target/113744] New: Unnecessary "m" constraint in *adddi_4 hjl.tools at gmail dot com
2024-02-03 15:00 ` [Bug target/113744] " hjl.tools at gmail dot com
2024-02-04 3:06 ` liuhongt at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).