diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2021-07-01 10:56:32 +0200 |
---|---|---|
committer | Uros Bizjak <ubizjak@gmail.com> | 2021-07-01 11:19:28 +0200 |
commit | 9f6aeb85ee87c6b4e580b6b71e26cbe99e1dab70 (patch) | |
tree | eb44f095de9f8f4ad52c769852078ea2fe1a089e /gcc/gimple-loop-interchange.cc | |
parent | 7d8211603a3d04384812b481b0ae01205a287a72 (diff) | |
download | gcc-9f6aeb85ee87c6b4e580b6b71e26cbe99e1dab70.zip gcc-9f6aeb85ee87c6b4e580b6b71e26cbe99e1dab70.tar.gz gcc-9f6aeb85ee87c6b4e580b6b71e26cbe99e1dab70.tar.bz2 |
i386: Add integer nabs instructions [PR101044]
The patch adds integer nabs "(NEG (ABS (...)))" instructions, adds STV
conversion and adjusts STV cost calculations accordingly. When CMOV
instruction is used to implement abs, the sign is determined from the
preceeding operand negation, and CMOVS is used to select between
negated and non-negated value.
To implement nabs, just reverse the condition and emit CMOVNS instead.
The STV costs are adjusted for inherent NOT of nabs insn. V2DI NOT is
somehow costly operation, since it is implemented as a load of zero,
followed by a SUB insn. OTOH, integer nabs with inherent NOT is relatively
cheap, so some STV chains became less profitable for conversion.
The patch rewrites operand scanner in compute_convert_gain to a switch
and reorders case instances in general_scalar_to_vector_candidate_p
to benefit from fallthroughs, and to remove special processing of
andnot in the later case.
gcc/
2021-07-01 Uroš Bizjak <ubizjak@gmail.com>
PR target/101044
* config/i386/i386.md (*nabs<dwi>2_doubleword):
New insn_and_split pattern.
(*nabs<dwi>2_1): Ditto.
* config/i386/i386-features.c
(general_scalar_chain::compute_convert_gain):
Handle (NEG (ABS (...))) RTX. Rewrite src code
scanner as switch statement.
(general_scalar_chain::convert_insn):
Handle (NEG (ABS (...))) RTX.
(general_scalar_to_vector_candidate_p):
Detect (NEG (ABS (...))) RTX. Reorder case statements
for (AND (NOT (...) ...)) fallthrough.
gcc/testsuite/
2021-07-01 Uroš Bizjak <ubizjak@gmail.com>
PR target/101044
* gcc.target/i386/pr101044.c: New test.
Diffstat (limited to 'gcc/gimple-loop-interchange.cc')
0 files changed, 0 insertions, 0 deletions