From 5eed254fbba468d25b9bc66854748a327f24b7b3 Mon Sep 17 00:00:00 2001
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Mon, 2 Sep 2024 19:41:41 +0200
Subject: [PATCH 09/11] Patch 59034

---
 gcc/config/sh/sh.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 26fa4e64380..53067cc6209 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -5492,10 +5492,19 @@
   prepare_move_operands (operands, <MODE>mode);
 })
 
+(define_insn "*mov<mode>_store_mem_index"
+  [(set (mem:QIHI
+		(plus:SI (match_operand:SI 0 "arith_reg_operand" "%r")
+			       (reg:SI R0_REG)))
+	   (match_operand:QIHI 1 "arith_reg_operand" "r"))]
+  "TARGET_SH1 && ! TARGET_SH2A && sh_lra_p ()"
+  "mov.<bw>	%1,@(r0,%0)"
+  [(set_attr "type" "store")])
+
 (define_insn_and_split "mov<mode>_store_mem_index"
   [(set (mem:QIHI
 		(plus:SI (match_operand:SI 0 "arith_reg_operand" "%r")
-			       (match_operand:SI 1 "arith_reg_operand" "r")))
+			       (match_operand:SI 1 "arith_reg_operand" "^zr")))
 	   (match_operand:QIHI 2 "arith_reg_operand" "r"))
    (clobber (reg:SI R0_REG))]
   "TARGET_SH1 && ! TARGET_SH2A && sh_lra_p ()"
-- 
2.45.2

