public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106632] New: undefined code causes assembler failure
@ 2022-08-15 22:56 pinskia at gcc dot gnu.org
  2022-08-15 22:57 ` [Bug target/106632] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-15 22:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106632
           Summary: undefined code causes assembler failure
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: assemble-failure
          Severity: normal
          Priority: P3
         Component: target
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: riscv-linux-gnu

Take:
long f(long a, long  b)
{
  b = 66;
  return (a >> b) & 1;
}

This will produce:
f:
        bexti   a0,a0,66
        ret

Which is invalid assembly as rejected by gas:
/tmp/ccTvKnLv.s: Assembler messages:
/tmp/ccTvKnLv.s:8: Error: improper shift amount (66)

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

* [Bug target/106632] undefined code causes assembler failure
  2022-08-15 22:56 [Bug target/106632] New: undefined code causes assembler failure pinskia at gcc dot gnu.org
@ 2022-08-15 22:57 ` pinskia at gcc dot gnu.org
  2022-08-24 19:20 ` cvs-commit at gcc dot gnu.org
  2022-08-24 19:21 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-15 22:57 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-08-15
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Mine.

Fixed:
diff --git a/gcc/config/riscv/bitmanip.md b/gcc/config/riscv/bitmanip.md
index 6f5f18eda41..80c5ccbfcbf 100644
--- a/gcc/config/riscv/bitmanip.md
+++ b/gcc/config/riscv/bitmanip.md
@@ -354,6 +354,6 @@ (define_insn "*bexti"
        (zero_extract:X (match_operand:X 1 "register_operand" "r")
                        (const_int 1)
                        (match_operand 2 "immediate_operand" "n")))]
-  "TARGET_ZBS"
+  "TARGET_ZBS && UINTVAL (operands[2]) < GET_MODE_BITSIZE (<MODE>mode)"
   "bexti\t%0,%1,%2"

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

* [Bug target/106632] undefined code causes assembler failure
  2022-08-15 22:56 [Bug target/106632] New: undefined code causes assembler failure pinskia at gcc dot gnu.org
  2022-08-15 22:57 ` [Bug target/106632] " pinskia at gcc dot gnu.org
@ 2022-08-24 19:20 ` cvs-commit at gcc dot gnu.org
  2022-08-24 19:21 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-24 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

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

commit r13-2190-gdf5204ddd4b8e3a2d02bb3ad5bcdb9d636b02537
Author: Andrew Pinski <apinski@marvell.com>
Date:   Mon Aug 15 22:58:09 2022 +0000

    [RISCV] Fix PR 106632 and PR 106588 a few constraints in bitmanip.md

    The constraints should be n instead of i. Also there
    needs to a check for out of bounds zero_extract for
    *bexti.

    gcc/ChangeLog:

            PR target/106632
            PR target/106588
            * config/riscv/bitmanip.md (*shNadduw): Use n constraint
            instead of i.
            (*slliuw): Likewise.
            (*bexti): Likewise. Also add a check for operands[2] to be less
            than the mode bitsize.

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

* [Bug target/106632] undefined code causes assembler failure
  2022-08-15 22:56 [Bug target/106632] New: undefined code causes assembler failure pinskia at gcc dot gnu.org
  2022-08-15 22:57 ` [Bug target/106632] " pinskia at gcc dot gnu.org
  2022-08-24 19:20 ` cvs-commit at gcc dot gnu.org
@ 2022-08-24 19:21 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-24 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-08-24 19:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 22:56 [Bug target/106632] New: undefined code causes assembler failure pinskia at gcc dot gnu.org
2022-08-15 22:57 ` [Bug target/106632] " pinskia at gcc dot gnu.org
2022-08-24 19:20 ` cvs-commit at gcc dot gnu.org
2022-08-24 19:21 ` pinskia 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).