diff mbox series

[PR100518] store by mult pieces: keep addr in Pmode

Message ID orczm57779.fsf@lxoliva.fsfla.org
State New
Headers show
Series [PR100518] store by mult pieces: keep addr in Pmode | expand

Commit Message

Alexandre Oliva Dec. 9, 2021, 10:18 p.m. UTC
The conversion of a MEM address to ptr_mode in
try_store_by_multiple_pieces was misguided: copy_addr_to_reg expects
Pmode for addresses.

Regstrapped on x86_64-linux-gnu, testcase verified with a cross to
aarch64.  Ok to install?


for  gcc/ChangeLog

	PR target/100518
	* builtins.c (try_store_by_multiple_pieces): Drop address
	conversion to ptr_mode.

for  gcc/testsuite/ChangeLog

	PR target/100518
	* gcc.target/aarch64/pr100518.c: New.
---
 gcc/builtins.c                              |    2 +-
 gcc/testsuite/gcc.target/aarch64/pr100518.c |    9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/pr100518.c

Comments

Jeff Law Dec. 10, 2021, 10:35 p.m. UTC | #1
On 12/9/2021 3:18 PM, Alexandre Oliva via Gcc-patches wrote:
> The conversion of a MEM address to ptr_mode in
> try_store_by_multiple_pieces was misguided: copy_addr_to_reg expects
> Pmode for addresses.
>
> Regstrapped on x86_64-linux-gnu, testcase verified with a cross to
> aarch64.  Ok to install?
>
>
> for  gcc/ChangeLog
>
> 	PR target/100518
> 	* builtins.c (try_store_by_multiple_pieces): Drop address
> 	conversion to ptr_mode.
>
> for  gcc/testsuite/ChangeLog
>
> 	PR target/100518
> 	* gcc.target/aarch64/pr100518.c: New.
OK
jeff
diff mbox series

Patch

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 304d87dafb750..cd8947b4de286 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -4003,7 +4003,7 @@  try_store_by_multiple_pieces (rtx to, rtx len, unsigned int ctz_len,
       constfundata = &valc;
     }
 
-  rtx ptr = copy_addr_to_reg (convert_to_mode (ptr_mode, XEXP (to, 0), 0));
+  rtx ptr = copy_addr_to_reg (XEXP (to, 0));
   rtx rem = copy_to_mode_reg (ptr_mode, convert_to_mode (ptr_mode, len, 0));
   to = replace_equiv_address (to, ptr);
   set_mem_align (to, align);
diff --git a/gcc/testsuite/gcc.target/aarch64/pr100518.c b/gcc/testsuite/gcc.target/aarch64/pr100518.c
new file mode 100644
index 0000000000000..5ca599f5d2e0e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr100518.c
@@ -0,0 +1,9 @@ 
+/* { dg-do compile } */
+/* { dg-options "-mabi=ilp32 -mstrict-align -O2" } */
+
+int unsigned_range_min, unsigned_range_max, a11___trans_tmp_1;
+
+void a11() {
+  a11___trans_tmp_1 = unsigned_range_max < unsigned_range_min;
+  __builtin_memset((char *)1, 0, a11___trans_tmp_1);
+}