public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/97158] New: [nvptx] Error compiling atomic complex double
@ 2020-09-22  8:02 vries at gcc dot gnu.org
  2020-09-23  7:21 ` [Bug target/97158] " cvs-commit at gcc dot gnu.org
  2020-09-23  7:24 ` vries at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-22  8:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97158
           Summary: [nvptx] Error compiling atomic complex double
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

...
$ cat gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-1.c
/* Test for _Atomic in C11.  Basic execution tests for atomic loads
   and stores.  */
/* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors" } */

extern void abort (void);

int
main (void)
{
  static volatile _Atomic (_Complex double) a;
  if (a != 0)
    abort ();

  return 0;
}
...

We run into:
...
ptxas /tmp/cc0rIzlE.o, line 100; error   : Rounding modifier required for
instruction 'cvt'
ptxas /tmp/cc0rIzlE.o, line 105; error   : Rounding modifier required for
instruction 'cvt'
...

First there are two loads into u64:
...
//(insn 10 12 11 2 (set (subreg:DI (reg:TI 22 [ _1 ]) 0)
//        (mem:DI (plus:DI (reg/f:DI 2 %frame)
//                (const_int 16 [0x10])) [3  S8 A128])) 7 {*movdi_insn}
//     (nil))
                ld.u64  %r22$0, [%frame+16];    // 10   [c=12]  *movdi_insn/1
//(insn 11 10 13 2 (set (subreg:DI (reg:TI 22 [ _1 ]) 8)                        
//        (mem:DI (plus:DI (reg/f:DI 2 %frame)                                  
//                (const_int 24 [0x18])) [3  S8 A64])) 7 {*movdi_insn}
//     (nil))
                ld.u64  %r22$8, [%frame+24];    // 11   [c=12]  *movdi_insn/1
...
and then two cvt operations from u64 to f64:
...
//(insn 13 11 14 2 (set (reg:DF 28 [ _9 ])
//        (subreg:DF (reg:TI 22 [ _1 ]) 0)) 9 {*movdf_insn}
//     (nil))
                cvt.f64.u64     %r28, %r22$0;   // 13   [c=12]  *movdf_insn/0
//(insn 14 13 17 2 (set (reg:DF 29 [ _10 ])
//        (subreg:DF (reg:TI 22 [ _1 ]) 8)) 9 {*movdf_insn}
//     (nil))
                cvt.f64.u64     %r29, %r22$8;   // 14   [c=12]  *movdf_insn/0
//(insn 17 14 18 2 (set (mem/c:DF (reg/f:DI 2 %frame) [2 REALPART_EXPR
<D.1263>+0 S8 A128])
//        (reg:DF 28 [ _9 ])) 9 {*movdf_insn}
//     (nil))
...

We should have mov.b64 instead.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/97158] [nvptx] Error compiling atomic complex double
  2020-09-22  8:02 [Bug target/97158] New: [nvptx] Error compiling atomic complex double vries at gcc dot gnu.org
@ 2020-09-23  7:21 ` cvs-commit at gcc dot gnu.org
  2020-09-23  7:24 ` vries at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-23  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 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:ca52f937fff52c494ef2951490c1654750ef8157

commit r11-3383-gca52f937fff52c494ef2951490c1654750ef8157
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Sep 22 13:16:39 2020 +0200

    [nvptx] Handle move from DF subreg to DF reg in nvptx_output_mov_insn

    When compiling test-case gcc.dg/atomic/c11-atomic-exec-1.c, we run into
    these ptxas errors:
    ...
    line 100; error: Rounding modifier required for instruction 'cvt'
    line 105; error: Rounding modifier required for instruction 'cvt'
    ...

    The problem is that this move:
    ...
    //(insn 13 11 14 2
    //      (set (reg:DF 28 [ _9 ])
    //           (subreg:DF (reg:TI 22 [ _1 ]) 0)) 9 {*movdf_insn}
    //       (nil))
                    cvt.f64.u64     %r28, %r22$0;
    ...
    is emitted as cvt.f64.u64, while it should be a mov.b64 instead.

    Fix this by handling this case in nvptx_output_mov_insn.

    Tested on nvptx.

    gcc/ChangeLog:

            PR target/97158
            * config/nvptx/nvptx.c (nvptx_output_mov_insn): Handle move from
            DF subreg to DF reg.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/97158] [nvptx] Error compiling atomic complex double
  2020-09-22  8:02 [Bug target/97158] New: [nvptx] Error compiling atomic complex double vries at gcc dot gnu.org
  2020-09-23  7:21 ` [Bug target/97158] " cvs-commit at gcc dot gnu.org
@ 2020-09-23  7:24 ` vries at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-23  7:24 UTC (permalink / raw)
  To: gcc-bugs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |11.0

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch with fix committed, test-case not required.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-23  7:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22  8:02 [Bug target/97158] New: [nvptx] Error compiling atomic complex double vries at gcc dot gnu.org
2020-09-23  7:21 ` [Bug target/97158] " cvs-commit at gcc dot gnu.org
2020-09-23  7:24 ` vries at gcc dot gnu.org

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).