From a7ad88a2bc51c8c01d37ad3a69cd383ad66bcda5 Mon Sep 17 00:00:00 2001
From: Oleg Endo <olegendo@gcc.gnu.org>
Date: Tue, 29 Jan 2013 20:29:29 +0000
Subject: [PATCH] re PR target/56121 ([SH] ICE in libgcc/unwind-dw2.c)

	PR target/56121
	* config/sh/sh.md (bclr_m2a, bset_m2a, bst_m2a, bld_m2a, bldsign_m2a,
	bld_reg, *bld_regqi, band_m2a, bandreg_m2a, bor_m2a, borreg_m2a,
	bxor_m2a, bxorreg_m2a): Add satisfies_constraint_K03 condition.

From-SVN: r195558
---
 gcc/ChangeLog       |  7 +++++++
 gcc/config/sh/sh.md | 28 +++++++++++++++-------------
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8888a2123d89..ff4ee0f4a6c2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-29  Oleg Endo  <olegendo@gcc.gnu.org>
+
+	PR target/56121
+	* config/sh/sh.md (bclr_m2a, bset_m2a, bst_m2a, bld_m2a, bldsign_m2a,
+	bld_reg, *bld_regqi, band_m2a, bandreg_m2a, bor_m2a, borreg_m2a,
+	bxor_m2a, bxorreg_m2a): Add satisfies_constraint_K03 condition.
+
 2013-01-29  Greta Yorsh  <Greta.Yorsh@arm.com>
 
         * config/arm/cortex-a7.md (cortex_a7_neon, cortex_a7_all): Remove.
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 02e9f990f441..d52a6b6854b1 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -13140,6 +13140,8 @@ label:
 })
 
 ;; SH2A instructions for bitwise operations.
+;; FIXME: Convert multiple instruction insns to insn_and_split.
+;; FIXME: Use iterators to fold at least and,xor,or insn variations.
 
 ;; Clear a bit in a memory location.
 (define_insn "bclr_m2a"
@@ -13148,7 +13150,7 @@ label:
 	    (not:QI (ashift:QI (const_int 1)
 			(match_operand:QI 1 "const_int_operand" "K03,K03")))
 	    (match_dup 0)))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[1])"
   "@
 	bclr.b	%1,%0
 	bclr.b	%1,@(0,%t0)"
@@ -13171,7 +13173,7 @@ label:
 	    (ashift:QI (const_int 1)
 		       (match_operand:QI 1 "const_int_operand" "K03,K03"))
 	    (match_dup 0)))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[1])"
   "@
 	bset.b	%1,%0
 	bset.b	%1,@(0,%t0)"
@@ -13198,7 +13200,7 @@ label:
 	    (ior:QI
 		(ashift:QI (const_int 1) (match_dup 1))
 		(match_dup 0))))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[1])"
   "@
 	bst.b	%1,%0
 	bst.b	%1,@(0,%t0)"
@@ -13211,7 +13213,7 @@ label:
 	    (match_operand:QI 0 "bitwise_memory_operand" "Sbw,Sbv")
 	    (const_int 1)
 	    (match_operand 1 "const_int_operand" "K03,K03")))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[1])"
   "@
 	bld.b	%1,%0
 	bld.b	%1,@(0,%t0)"
@@ -13224,7 +13226,7 @@ label:
 	    (match_operand:QI 0 "bitwise_memory_operand" "Sbw,m")
 	    (const_int 1)
 	    (match_operand 1 "const_int_operand" "K03,K03")))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[1])"
   "@
 	bld.b	%1,%0
 	bld.b	%1,@(0,%t0)"
@@ -13236,7 +13238,7 @@ label:
 	(zero_extract:SI (match_operand:SI 0 "arith_reg_operand" "r")
 			 (const_int 1)
 			 (match_operand 1 "const_int_operand" "K03")))]
-  "TARGET_SH2A"
+  "TARGET_SH2A && satisfies_constraint_K03 (operands[1])"
   "bld	%1,%0")
 
 (define_insn "*bld_regqi"
@@ -13244,7 +13246,7 @@ label:
 	(zero_extract:SI (match_operand:QI 0 "arith_reg_operand" "r")
 			 (const_int 1)
 			 (match_operand 1 "const_int_operand" "K03")))]
-  "TARGET_SH2A"
+  "TARGET_SH2A && satisfies_constraint_K03 (operands[1])"
   "bld	%1,%0")
 
 ;; Take logical and of a specified bit of memory with the T bit and
@@ -13256,7 +13258,7 @@ label:
 		    (match_operand:QI 0 "bitwise_memory_operand" "Sbw,m")
 		    (const_int 1)
 		    (match_operand 1 "const_int_operand" "K03,K03"))))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[1])"
   "@
 	band.b	%1,%0
 	band.b	%1,@(0,%t0)"
@@ -13269,7 +13271,7 @@ label:
 		    (const_int 1)
 		    (match_operand 2 "const_int_operand" "K03,K03"))
         	(match_operand:SI 3 "register_operand" "r,r")))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[2])"
 {
   static const char* alt[] =
   {
@@ -13292,7 +13294,7 @@ label:
 		    (match_operand:QI 0 "bitwise_memory_operand" "Sbw,m")
 		    (const_int 1)
 		    (match_operand 1 "const_int_operand" "K03,K03"))))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[1])"
   "@
 	bor.b	%1,%0
 	bor.b	%1,@(0,%t0)"
@@ -13305,7 +13307,7 @@ label:
 		    (const_int 1)
 		    (match_operand 2 "const_int_operand" "K03,K03"))
 		(match_operand:SI 3 "register_operand" "=r,r")))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[2])"
 {
   static const char* alt[] =
   {
@@ -13328,7 +13330,7 @@ label:
 		    (match_operand:QI 0 "bitwise_memory_operand" "Sbw,m")
 		    (const_int 1)
 		    (match_operand 1 "const_int_operand" "K03,K03"))))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[1])"
   "@
 	bxor.b	%1,%0
 	bxor.b	%1,@(0,%t0)"
@@ -13341,7 +13343,7 @@ label:
 		    (const_int 1)
 		    (match_operand 2 "const_int_operand" "K03,K03"))
 		(match_operand:SI 3 "register_operand" "=r,r")))]
-  "TARGET_SH2A && TARGET_BITOPS"
+  "TARGET_SH2A && TARGET_BITOPS && satisfies_constraint_K03 (operands[2])"
 {
   static const char* alt[] =
   {
-- 
GitLab