public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/101044] -ABS(A) produces two neg instructions
Date: Thu, 01 Jul 2021 09:21:03 +0000	[thread overview]
Message-ID: <bug-101044-4-KTsOZv8ozC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101044-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101044

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:

https://gcc.gnu.org/g:9f6aeb85ee87c6b4e580b6b71e26cbe99e1dab70

commit r12-1950-g9f6aeb85ee87c6b4e580b6b71e26cbe99e1dab70
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Thu Jul 1 10:56:32 2021 +0200

    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.

  parent reply	other threads:[~2021-07-01  9:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-13  2:37 [Bug rtl-optimization/101044] New: " pinskia at gcc dot gnu.org
2021-06-13 12:00 ` [Bug rtl-optimization/101044] " ubizjak at gmail dot com
2021-06-29  9:38 ` ubizjak at gmail dot com
2021-06-29  9:51 ` ubizjak at gmail dot com
2021-07-01  9:21 ` cvs-commit at gcc dot gnu.org [this message]
2021-07-01  9:24 ` [Bug target/101044] " ubizjak at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101044-4-KTsOZv8ozC@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).