diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2022-10-20 11:55:19 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2022-10-27 11:41:54 -0700 |
commit | 0e36a9c6915c713d30016cbade97a4b31dcc1350 (patch) | |
tree | 19af9d463981225452ec3a82498371f9a269612b /gcc/cppmain.c | |
parent | 1c2b53ce8bbf5bbe1ddb13bb6005f432726518ae (diff) | |
download | gcc-0e36a9c6915c713d30016cbade97a4b31dcc1350.zip gcc-0e36a9c6915c713d30016cbade97a4b31dcc1350.tar.gz gcc-0e36a9c6915c713d30016cbade97a4b31dcc1350.tar.bz2 |
x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns
In i386.md, neg patterns which set MODE_CC register like
(set (reg:CCC FLAGS_REG)
(ne:CCC (match_operand:SWI48 1 "general_reg_operand") (const_int 0)))
can lead to errors when operand 1 is a constant value. If FLAGS_REG in
(set (reg:CCC FLAGS_REG)
(ne:CCC (const_int 2) (const_int 0)))
is set to 1, RTX simplifiers may simplify
(set (reg:SI 93)
(neg:SI (ltu:SI (reg:CCC 17 flags) (const_int 0 [0]))))
as
(set (reg:SI 93)
(neg:SI (ltu:SI (const_int 1) (const_int 0 [0]))))
which leads to incorrect results since LTU on MODE_CC register isn't the
same as "unsigned less than" in x86 backend. To prevent RTL optimizers
from setting MODE_CC register to a constant, use UNSPEC_CC_NE to replace
ne:CCC/ne:CCO when setting FLAGS_REG in neg patterns.
gcc/
PR target/107172
* config/i386/i386.md (UNSPEC_CC_NE): New.
Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns.
gcc/testsuite/
PR target/107172
* gcc.target/i386/pr107172.c: New test.
Diffstat (limited to 'gcc/cppmain.c')
0 files changed, 0 insertions, 0 deletions