public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tschwinge at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/105075] [nvptx] Generate sad insn (sum of absolute differences)
Date: Mon, 28 Mar 2022 09:50:47 +0000	[thread overview]
Message-ID: <bug-105075-4-jg7MShljW6@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105075-4@http.gcc.gnu.org/bugzilla/>

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

Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org,
                   |                            |tschwinge at gcc dot gnu.org
   Last reconfirmed|                            |2022-03-28
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #4 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> ptx has sad ((sum of absolute differences)) insn, which is currently not
> modeled in the .md file.

I also had noticed this, a while ago (but no opportunity to work on it
properly).

I had found GCC/RTL 'ssad', 'usad', and 'gcc/tree.def:SAD_EXPR', but not
verified their applicability.


(In reply to Tom de Vries from comment #2)
> AFAIU, at gimple level support is limited to vectors, so that doesn't help
> to generate the insn for the simple, scalar case.
> 
> It would be nice if combine could generate it and we wouldn't have to use a
> peephole, but AFAIU the pattern is too complex for that.
> 
> I wonder if reformulating using a conditional could help there (ptx isa
> describes semantics using "c + ((a<b) ? b-a : a-b)".

Would that not be a case for a proper TREE-level representation, and
'gcc/match.pd' patterns to catch and transform any appearances to that, and
then let each back end generate an ideal sequence of instructions (with a
default to the expression you gave above)?

> Also, I wonder if defining a stepping-stone intermediate pattern could help
> combine.

  parent reply	other threads:[~2022-03-28  9:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28  7:53 [Bug target/105075] New: " vries at gcc dot gnu.org
2022-03-28  8:08 ` [Bug target/105075] " vries at gcc dot gnu.org
2022-03-28  8:13 ` vries at gcc dot gnu.org
2022-03-28  8:24 ` vries at gcc dot gnu.org
2022-03-28  9:50 ` tschwinge at gcc dot gnu.org [this message]
2022-03-28 10:15 ` rguenth at gcc dot gnu.org
2022-03-28 13:06 ` vries at gcc dot gnu.org
2022-03-28 13:15 ` rguenther at suse dot de

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-105075-4-jg7MShljW6@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).