public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/54272] [SH] Add support for addv / subv instructions
Date: Thu, 16 Aug 2012 20:35:00 -0000	[thread overview]
Message-ID: <bug-54272-4-WprEP57DHM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54272-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54272

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-08-16
     Ever Confirmed|0                           |1

--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-08-16 20:34:53 UTC ---
Regarding saturating arithmetic, I took the function FIXED_SSADD from
libgcc/fixed-bit.c and substituted FIXED_C_TYPE with int.

int test_01 (int a, int b)
{
  int c;
  int x, y, z;
  x = a;
  y = b;
  z = x + y;
  if ((((x ^ y) >> 31) & 1) == 0)
    {
      if (((z ^ x) >> 31) & 1)
        {
          z = 1;
          z = z << 31;
          if (x >= 0)
            z--;
        }
    }
  c = z;
  return c;
}

compiled with -O2 -m4 -ml:
        div0s   r4,r5
        mov     r4,r0
        bt/s    .L4
        add     r5,r0
        div0s   r0,r4
        bt/s    .L6
        cmp/pz  r4
.L4:
        rts
        nop
        .align 1
.L6:
        mov.l   .L7,r0
        movt    r1
        rts
        sub     r1,r0
.L8:
        .align 2
.L7:
        .long   -2147483648

In this case combine can successfully match the div0s sign comparison patterns
that I added in PR 52933.  However, after matching those, it does not try to
combine the patterns any further (probably because of the conditional
branches). I guess this would be a job for an optimization at the GIMPLE level.


  parent reply	other threads:[~2012-08-16 20:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-15 16:03 [Bug target/54272] New: " olegendo at gcc dot gnu.org
2012-08-15 16:17 ` [Bug target/54272] " olegendo at gcc dot gnu.org
2012-08-16 11:24 ` kkojima at gcc dot gnu.org
2012-08-16 12:43 ` olegendo at gcc dot gnu.org
2012-08-16 13:00 ` kkojima at gcc dot gnu.org
2012-08-16 20:35 ` olegendo at gcc dot gnu.org [this message]
2013-09-19 11:07 ` olegendo at gcc dot gnu.org
2014-07-24 19:23 ` olegendo at gcc dot gnu.org
2014-11-16  2:26 ` olegendo at gcc dot gnu.org

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-54272-4-WprEP57DHM@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).