public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/108790] New: bpf: gcc emits malformed ldxdw instruction at -O2
@ 2023-02-14 18:52 david.faust at oracle dot com
  2023-02-14 22:47 ` [Bug target/108790] " cvs-commit at gcc dot gnu.org
  2023-08-17 17:18 ` jemarch at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: david.faust at oracle dot com @ 2023-02-14 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108790
           Summary: bpf: gcc emits malformed ldxdw instruction at -O2
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.faust at oracle dot com
                CC: cupertino.miranda at oracle dot com
  Target Milestone: ---
            Target: bpf

With -O2 GCC emits a malformed ldxdw instruction in some cases:

$ cat ldxdw.c
unsigned long long test () {
  return *((unsigned long long *) 0x4000);
}

$ bpf-unknown-none-gcc -c -O2 ldxdw.c -o ldxdw.o
/tmp/ccsuVj7l.s: Assembler messages:
/tmp/ccsuVj7l.s:7: Error: unrecognized form of instruction `ldxdw %r0,16384'

ldxdw (and all other {ldx,stx}{b,h,w,dw} insns should have a form like

    ldxdw %rX, [%rY + OFFSET]

Looks like we need a better constraint on the memory operand in *mov<MM:mode>.

Testing a patch for this now.

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

* [Bug target/108790] bpf: gcc emits malformed ldxdw instruction at -O2
  2023-02-14 18:52 [Bug target/108790] New: bpf: gcc emits malformed ldxdw instruction at -O2 david.faust at oracle dot com
@ 2023-02-14 22:47 ` cvs-commit at gcc dot gnu.org
  2023-08-17 17:18 ` jemarch at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-14 22:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Faust <dfaust@gcc.gnu.org>:

https://gcc.gnu.org/g:c348a717213b03c6661878934f197f4d261f0e56

commit r13-5989-gc348a717213b03c6661878934f197f4d261f0e56
Author: David Faust <david.faust@oracle.com>
Date:   Tue Feb 14 11:23:01 2023 -0800

    bpf: fix memory constraint of ldx/stx instructions [PR108790]

    In some cases where the target memory address for an ldx or stx
    instruction could be reduced to a constant, GCC could emit a malformed
    instruction like:

        ldxdw %r0,0

    Rather than the expected form:

        ldxdw %rX, [%rY + OFFSET]

    This is due to the constraint allowing a const_int operand, which the
    output templates do not handle.

    Fix it by introducing a new memory constraint for the appropriate
    operands of these instructions, which is identical to 'm' except that
    it does not accept const_int.

    gcc/

            PR target/108790
            * config/bpf/constraints.md (q): New memory constraint.
            * config/bpf/bpf.md (zero_extendhidi2): Use it here.
            (zero_extendqidi2): Likewise.
            (zero_extendsidi2): Likewise.
            (*mov<MM:mode>): Likewise.

    gcc/testsuite/

            PR target/108790
            * gcc.target/bpf/ldxdw.c: New test.

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

* [Bug target/108790] bpf: gcc emits malformed ldxdw instruction at -O2
  2023-02-14 18:52 [Bug target/108790] New: bpf: gcc emits malformed ldxdw instruction at -O2 david.faust at oracle dot com
  2023-02-14 22:47 ` [Bug target/108790] " cvs-commit at gcc dot gnu.org
@ 2023-08-17 17:18 ` jemarch at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jemarch at gcc dot gnu.org @ 2023-08-17 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jose E. Marchesi <jemarch at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |jemarch at gcc dot gnu.org

--- Comment #2 from Jose E. Marchesi <jemarch at gcc dot gnu.org> ---
Fixed by the commit above.

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

end of thread, other threads:[~2023-08-17 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-14 18:52 [Bug target/108790] New: bpf: gcc emits malformed ldxdw instruction at -O2 david.faust at oracle dot com
2023-02-14 22:47 ` [Bug target/108790] " cvs-commit at gcc dot gnu.org
2023-08-17 17:18 ` jemarch 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).