From 89880ef26d884e4787aa77ffedbabc3b7011821f Mon Sep 17 00:00:00 2001
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Tue, 3 Sep 2024 11:31:49 +0200
Subject: [PATCH 11/11] Patch 59044

---
 gcc/config/sh/sh.md | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 53067cc6209..10c14990179 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -5495,10 +5495,11 @@
 (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)"
+			       (match_operand:SI 1 "arith_reg_operand" "z")))
+	   (match_operand:QIHI 2 "arith_reg_operand" "r"))]
+  "TARGET_SH1 && ! TARGET_SH2A && sh_lra_p ()
+   && REG_P (operands[1]) && REGNO (operands[1]) == R0_REG"
+  "mov.<bw>	%2,@(%1,%0)"
   [(set_attr "type" "store")])
 
 (define_insn_and_split "mov<mode>_store_mem_index"
-- 
2.45.2

