* [committed] i386: Improve cmpstrnqi_1 insn pattern [PR112494]
@ 2023-11-28 15:59 Uros Bizjak
0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2023-11-28 15:59 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 496 bytes --]
REPZ CMPSB instruction does not update FLAGS register when %ecx register
equals zero. Improve cmpstrnqi_1 insn pattern to set FLAGS_REG to its
previous value instead of (const_int 0) when operand 2 equals zero.
PR target/112494
gcc/ChangeLog:
* config/i386/i386.md (cmpstrnqi_1): Set FLAGS_REG to its previous
value when operand 2 equals zero.
(*cmpstrnqi_1): Ditto.
(*cmpstrnqi_1 peephole2): Ditto.
Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1954 bytes --]
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index cb32de7fab8..7641b479670 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -23333,9 +23333,8 @@ (define_expand "cmpstrnqi_1"
(const_int 0))
(compare:CC (match_operand 4 "memory_operand")
(match_operand 5 "memory_operand"))
- (const_int 0)))
+ (reg:CC FLAGS_REG)))
(use (match_operand:SI 3 "immediate_operand"))
- (use (reg:CC FLAGS_REG))
(clobber (match_operand 0 "register_operand"))
(clobber (match_operand 1 "register_operand"))
(clobber (match_dup 2))])]
@@ -23351,9 +23350,8 @@ (define_insn "*cmpstrnqi_1"
(const_int 0))
(compare:CC (mem:BLK (match_operand:P 4 "register_operand" "0"))
(mem:BLK (match_operand:P 5 "register_operand" "1")))
- (const_int 0)))
+ (reg:CC FLAGS_REG)))
(use (match_operand:SI 3 "immediate_operand" "i"))
- (use (reg:CC FLAGS_REG))
(clobber (match_operand:P 0 "register_operand" "=S"))
(clobber (match_operand:P 1 "register_operand" "=D"))
(clobber (match_operand:P 2 "register_operand" "=c"))]
@@ -23464,9 +23462,8 @@ (define_peephole2
(const_int 0))
(compare:CC (mem:BLK (match_operand 4 "register_operand"))
(mem:BLK (match_operand 5 "register_operand")))
- (const_int 0)))
+ (reg:CC FLAGS_REG)))
(use (match_operand:SI 3 "immediate_operand"))
- (use (reg:CC FLAGS_REG))
(clobber (match_operand 0 "register_operand"))
(clobber (match_operand 1 "register_operand"))
(clobber (match_operand 2 "register_operand"))])
@@ -23484,9 +23481,8 @@ (define_peephole2
(const_int 0))
(compare:CC (mem:BLK (match_dup 4))
(mem:BLK (match_dup 5)))
- (const_int 0)))
+ (reg:CC FLAGS_REG)))
(use (match_dup 3))
- (use (reg:CC FLAGS_REG))
(clobber (match_dup 0))
(clobber (match_dup 1))
(clobber (match_dup 2))])])
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-28 15:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 15:59 [committed] i386: Improve cmpstrnqi_1 insn pattern [PR112494] Uros Bizjak
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).