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/97005] [nvptx] FAIL: c-c++-common/torture/builtin-arith-overflow-15.c   -O0  execution test
Date: Thu, 10 Feb 2022 08:52:30 +0000	[thread overview]
Message-ID: <bug-97005-4-pY6eF5YoK2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97005-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@gcc.gnu.org>:

https://gcc.gnu.org/g:5b2d679bbbcc2b976c6e228ba63afdf67c33164e

commit r12-7170-g5b2d679bbbcc2b976c6e228ba63afdf67c33164e
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Feb 7 14:12:34 2022 +0100

    [nvptx] Workaround sub.u16 driver JIT bug

    There's a nvidia driver JIT bug that mishandles this code (minimized from
    builtin-arith-overflow-15.c):
    ...
    int main (void) {
      signed char r;
      unsigned char y = (unsigned char) 0x80;
      if (__builtin_sub_overflow ((unsigned char)0, (unsigned char)y, &r))
        __builtin_abort ();
      return 0;
    }
    ...
    which at ptx level minimizes to:
    ...
      mov.u16 r22, 0x0080;
      st.local.u16 [frame_var],r22;
      ld.local.u16 r32,[frame_var];
      sub.u16 r33,0x0000,r32;
      cvt.u32.u16 r35,r33;
    ...
    where we expect r35 == 0x0000ff80 but get instead 0xffffff80, and where
using
    nvptx-none-run -O0 fixes the problem.  [ See also
    https://github.com/vries/nvidia-bugs/tree/master/builtin-arith-overflow-15
. ]

    Try to workaround the bug by using sub.s16 instead of sub.u16.

    Tested on nvptx.

    gcc/ChangeLog:

    2022-02-07  Tom de Vries  <tdevries@suse.de>

            PR target/97005
            * config/nvptx/nvptx.md (define_insn "sub<mode>3"): Workaround
            driver JIT bug by using sub.s16 instead of sub.u16.

  parent reply	other threads:[~2022-02-10  8:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 23:38 [Bug target/97005] New: " vries at gcc dot gnu.org
2022-02-06  8:04 ` [Bug target/97005] " vries at gcc dot gnu.org
2022-02-06  8:42 ` vries at gcc dot gnu.org
2022-02-06 10:41 ` jakub at gcc dot gnu.org
2022-02-07  8:43 ` vries at gcc dot gnu.org
2022-02-07  8:48 ` jakub at gcc dot gnu.org
2022-02-07  8:52 ` vries at gcc dot gnu.org
2022-02-07  8:57 ` vries at gcc dot gnu.org
2022-02-07 11:49 ` vries at gcc dot gnu.org
2022-02-10  8:52 ` cvs-commit at gcc dot gnu.org [this message]
2022-02-10  8:55 ` vries at gcc dot gnu.org
2022-02-24 20:07 ` vries 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-97005-4-pY6eF5YoK2@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).