[Bug target/88236] [avr] Invalid code generated for __memx char pointer deference for avr5 arch

2024-07-01 Thread gjl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88236

Georg-Johann Lay  changed:

   What|Removed |Added

   Target Milestone|--- |14.2
 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #7 from Georg-Johann Lay  ---
Fixed in v12.5, v13.4 and v14.2+

[Bug target/88236] [avr] Invalid code generated for __memx char pointer deference for avr5 arch

2024-07-01 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88236

--- Comment #6 from GCC Commits  ---
The releases/gcc-12 branch has been updated by Georg-Johann Lay
:

https://gcc.gnu.org/g:53305588cfbf74604bafcc27902e1eded5677ae6

commit r12-10591-g53305588cfbf74604bafcc27902e1eded5677ae6
Author: Georg-Johann Lay 
Date:   Mon Jul 1 12:31:01 2024 +0200

AVR: target/88236, target/115726 - Fix __memx code generation.

PR target/88236
PR target/115726
gcc/
* config/avr/avr.md (mov) [avr_mem_memx_p]: Expand in such a
way that the destination does not overlap with any hard register
clobbered / used by xload8qi_A resp. xload_A.
* config/avr/avr.cc (avr_out_xload): Avoid early-clobber
situation for Z by executing just one load when the output register
overlaps with Z.
gcc/testsuite/
* gcc.target/avr/torture/pr88236-pr115726.c: New test.

(cherry picked from commit 3d23abd3dd9c8c226ea302203b214b346f4fe8d7)

[Bug target/88236] [avr] Invalid code generated for __memx char pointer deference for avr5 arch

2024-07-01 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88236

--- Comment #5 from GCC Commits  ---
The releases/gcc-13 branch has been updated by Georg-Johann Lay
:

https://gcc.gnu.org/g:743575bfc6cfb3520047bddf969f880455d581b1

commit r13-8882-g743575bfc6cfb3520047bddf969f880455d581b1
Author: Georg-Johann Lay 
Date:   Mon Jul 1 12:31:01 2024 +0200

AVR: target/88236, target/115726 - Fix __memx code generation.

PR target/88236
PR target/115726
gcc/
* config/avr/avr.md (mov) [avr_mem_memx_p]: Expand in such a
way that the destination does not overlap with any hard register
clobbered / used by xload8qi_A resp. xload_A.
* config/avr/avr.cc (avr_out_xload): Avoid early-clobber
situation for Z by executing just one load when the output register
overlaps with Z.
gcc/testsuite/
* gcc.target/avr/torture/pr88236-pr115726.c: New test.

(cherry picked from commit 3d23abd3dd9c8c226ea302203b214b346f4fe8d7)

[Bug target/88236] [avr] Invalid code generated for __memx char pointer deference for avr5 arch

2024-07-01 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88236

--- Comment #4 from GCC Commits  ---
The releases/gcc-14 branch has been updated by Georg-Johann Lay
:

https://gcc.gnu.org/g:7249b3cdc16ae85bcfeb63510b6e5cb7f4a43adb

commit r14-10367-g7249b3cdc16ae85bcfeb63510b6e5cb7f4a43adb
Author: Georg-Johann Lay 
Date:   Mon Jul 1 12:31:01 2024 +0200

AVR: target/88236, target/115726 - Fix __memx code generation.

PR target/88236
PR target/115726
gcc/
* config/avr/avr.md (mov) [avr_mem_memx_p]: Expand in such a
way that the destination does not overlap with any hard register
clobbered / used by xload8qi_A resp. xload_A.
* config/avr/avr.cc (avr_out_xload): Avoid early-clobber
situation for Z by executing just one load when the output register
overlaps with Z.
gcc/testsuite/
* gcc.target/avr/torture/pr88236-pr115726.c: New test.

(cherry picked from commit 3d23abd3dd9c8c226ea302203b214b346f4fe8d7)

[Bug target/88236] [avr] Invalid code generated for __memx char pointer deference for avr5 arch

2024-07-01 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88236

--- Comment #3 from GCC Commits  ---
The master branch has been updated by Georg-Johann Lay :

https://gcc.gnu.org/g:3d23abd3dd9c8c226ea302203b214b346f4fe8d7

commit r15-1750-g3d23abd3dd9c8c226ea302203b214b346f4fe8d7
Author: Georg-Johann Lay 
Date:   Mon Jul 1 12:31:01 2024 +0200

AVR: target/88236, target/115726 - Fix __memx code generation.

PR target/88236
PR target/115726
gcc/
* config/avr/avr.md (mov) [avr_mem_memx_p]: Expand in such a
way that the destination does not overlap with any hard register
clobbered / used by xload8qi_A resp. xload_A.
* config/avr/avr.cc (avr_out_xload): Avoid early-clobber
situation for Z by executing just one load when the output register
overlaps with Z.
gcc/testsuite/
* gcc.target/avr/torture/pr88236-pr115726.c: New test.

[Bug target/88236] [avr] Invalid code generated for __memx char pointer deference for avr5 arch

2018-11-29 Thread saaadhu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88236

Senthil Kumar Selvaraj  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |saaadhu at gcc dot 
gnu.org

--- Comment #2 from Senthil Kumar Selvaraj  ---
Created attachment 45119
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45119&action=edit
Bug fix patch

If reload choses r30 (or r31) as operand 0 of xload_8, the lpmx
constraint
alternative ends up generating wrong code, as avrt_out_xload would emit
  lpm r30, Z
  sbrc , 7
  ld r30, Z

r30 gets clobbered by LPM, and LD with Z will therefore not work correctly.
This
happens even though operand 0 is marked as early clobber in the insn,
presumably
because of the hard coded (reg:HI REG_Z).

If (reg:HI REG_Z) is replaced with
 (match_operand:HI 2 "register_operand" "z,z")

then reload does respect the early clobber, but fails with "unable to find
register to spill in pointer class POINTER_REGS_Z", probably because the
xload8_A hardcodes REG_Z as the third operand.

Adding a clobber for REG_Z prevents reload from assigning r30 as the output
operand, even though REG_Z isn't technically clobbered. One other way to fix
this would be to add a new register constraint that tells reload to use any
register other than REG_Z. It likely won't make any difference in code gen, as
REG_Z would have been clobbered by xload8_A anyway.

[Bug target/88236] [avr] Invalid code generated for __memx char pointer deference for avr5 arch

2018-11-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88236

Richard Biener  changed:

   What|Removed |Added

   Keywords||wrong-code
 Target||avr
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-11-28
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
Confirmed.