This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SH] Use match_test rather than eq/ne symbol_ref


As per the subject.  Tested by making sure that there were no new
warnings building sh-linux-gnu, and that there were no changes
in the assembly output for the C and C++ testsuite.  OK to install?

Richard


gcc/
	* config/sh/sh.md: Use match_test rather than eq/ne symbol_ref
	throughout file.

Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md	2011-09-13 18:43:39.000000000 +0100
+++ gcc/config/sh/sh.md	2011-09-13 19:04:01.000000000 +0100
@@ -346,11 +346,11 @@ (define_attr "fp_set" "single,double,unk
 ;; ??? This looks ugly because genattrtab won't allow if_then_else or cond
 ;; inside an le.
 (define_attr "short_cbranch_p" "no,yes"
-  (cond [(ne (symbol_ref "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_int 0))
+  (cond [(match_test "mdep_reorg_phase <= SH_FIXUP_PCLOAD")
 	 (const_string "no")
 	 (leu (plus (minus (match_dup 0) (pc)) (const_int 252)) (const_int 506))
 	 (const_string "yes")
-	 (ne (symbol_ref "NEXT_INSN (PREV_INSN (insn)) != insn") (const_int 0))
+	 (match_test "NEXT_INSN (PREV_INSN (insn)) != insn")
 	 (const_string "no")
 	 (leu (plus (minus (match_dup 0) (pc)) (const_int 252)) (const_int 508))
 	 (const_string "yes")
@@ -360,7 +360,7 @@ (define_attr "med_branch_p" "no,yes"
   (cond [(leu (plus (minus (match_dup 0) (pc)) (const_int 990))
 	      (const_int 1988))
 	 (const_string "yes")
-	 (ne (symbol_ref "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_int 0))
+	 (match_test "mdep_reorg_phase <= SH_FIXUP_PCLOAD")
 	 (const_string "no")
 	 (leu (plus (minus (match_dup 0) (pc)) (const_int 4092))
 	      (const_int 8186))
@@ -371,7 +371,7 @@ (define_attr "med_cbranch_p" "no,yes"
   (cond [(leu (plus (minus (match_dup 0) (pc)) (const_int 988))
 	      (const_int 1986))
 	 (const_string "yes")
-	 (ne (symbol_ref "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_int 0))
+	 (match_test "mdep_reorg_phase <= SH_FIXUP_PCLOAD")
 	 (const_string "no")
 	 (leu (plus (minus (match_dup 0) (pc)) (const_int 4090))
 	       (const_int 8184))
@@ -379,12 +379,12 @@ (define_attr "med_cbranch_p" "no,yes"
 	 ] (const_string "no")))
 
 (define_attr "braf_branch_p" "no,yes"
-  (cond [(ne (symbol_ref "! TARGET_SH2") (const_int 0))
+  (cond [(match_test "! TARGET_SH2")
 	 (const_string "no")
 	 (leu (plus (minus (match_dup 0) (pc)) (const_int 10330))
 	      (const_int 20660))
 	 (const_string "yes")
-	 (ne (symbol_ref "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_int 0))
+	 (match_test "mdep_reorg_phase <= SH_FIXUP_PCLOAD")
 	 (const_string "no")
 	 (leu (plus (minus (match_dup 0) (pc)) (const_int 32764))
 	      (const_int 65530))
@@ -392,12 +392,12 @@ (define_attr "braf_branch_p" "no,yes"
 	 ] (const_string "no")))
 
 (define_attr "braf_cbranch_p" "no,yes"
-  (cond [(ne (symbol_ref "! TARGET_SH2") (const_int 0))
+  (cond [(match_test "! TARGET_SH2")
 	 (const_string "no")
 	 (leu (plus (minus (match_dup 0) (pc)) (const_int 10328))
 	      (const_int 20658))
 	 (const_string "yes")
-	 (ne (symbol_ref "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_int 0))
+	 (match_test "mdep_reorg_phase <= SH_FIXUP_PCLOAD")
 	 (const_string "no")
 	 (leu (plus (minus (match_dup 0) (pc)) (const_int 32762))
 	      (const_int 65528))
@@ -426,39 +426,36 @@ (define_attr "length" ""
 ;; ??? using pc is not computed transitively.
 		(ne (match_dup 0) (match_dup 0))
 		(const_int 14)
-		(ne (symbol_ref ("flag_pic")) (const_int 0))
+		(match_test "flag_pic")
 		(const_int 24)
 		] (const_int 16))
 	 (eq_attr "type" "jump")
 	 (cond [(eq_attr "med_branch_p" "yes")
 		(const_int 2)
-		(and (ne (symbol_ref "prev_nonnote_insn (insn)")
-			 (const_int 0))
-		     (and (eq (symbol_ref "GET_CODE (prev_nonnote_insn (insn))")
-			      (symbol_ref "INSN"))
-			  (eq (symbol_ref "INSN_CODE (prev_nonnote_insn (insn))")
-			      (symbol_ref "code_for_indirect_jump_scratch"))))
+		(and (match_test "prev_nonnote_insn (insn)")
+		     (and (eq (symbol_ref "GET_CODE (prev_nonnote_insn (insn))")			      (symbol_ref "INSN"))
+			  (eq (symbol_ref "INSN_CODE (prev_nonnote_insn (insn))")			      (symbol_ref "code_for_indirect_jump_scratch"))))
                 (cond [(eq_attr "braf_branch_p" "yes")
                        (const_int 6)
-                       (eq (symbol_ref "flag_pic") (const_int 0))
+                       (not (match_test "flag_pic"))
                        (const_int 10)
-                       (ne (symbol_ref "TARGET_SH2") (const_int 0))
+                       (match_test "TARGET_SH2")
                        (const_int 10)] (const_int 18))
 		(eq_attr "braf_branch_p" "yes")
 		(const_int 10)
 ;; ??? using pc is not computed transitively.
 		(ne (match_dup 0) (match_dup 0))
 		(const_int 12)
-		(ne (symbol_ref ("flag_pic")) (const_int 0))
+		(match_test "flag_pic")
 		(const_int 22)
 		] (const_int 14))
 	 (eq_attr "type" "pt_media")
-	 (if_then_else (ne (symbol_ref "TARGET_SHMEDIA64") (const_int 0))
+	 (if_then_else (match_test "TARGET_SHMEDIA64")
 		       (const_int 20) (const_int 12))
 	 (and (eq_attr "type" "jump_media")
-	      (ne (symbol_ref "TARGET_SH5_CUT2_WORKAROUND") (const_int 0)))
+	      (match_test "TARGET_SH5_CUT2_WORKAROUND"))
 	 (const_int 8)
-	 ] (if_then_else (ne (symbol_ref "TARGET_SHMEDIA") (const_int 0))
+	 ] (if_then_else (match_test "TARGET_SHMEDIA")
 			 (const_int 4)
 			 (const_int 2))))
 
@@ -476,15 +473,13 @@ (include "constraints.md")
 (define_attr "needs_delay_slot" "yes,no" (const_string "no"))
 
 (define_attr "banked" "yes,no" 
-	(cond [(eq (symbol_ref "sh_loads_bankedreg_p (insn)")
-		   (const_int 1))
+	(cond [(match_test "sh_loads_bankedreg_p (insn)")
 	       (const_string "yes")]
 	      (const_string "no")))
 
 ;; ??? This should be (nil) instead of (const_int 0)
 (define_attr "hit_stack" "yes,no"
-	(cond [(eq (symbol_ref "find_regno_note (insn, REG_INC, SP_REG)")
-		   (const_int 0))
+	(cond [(not (match_test "find_regno_note (insn, REG_INC, SP_REG)"))
 	       (const_string "no")]
 	      (const_string "yes")))
 
@@ -559,7 +554,7 @@ (define_delay
 		  (eq_attr "type" "!pload,prset"))
 	     (and (eq_attr "interrupt_function" "yes")
 		  (ior
-		   (eq (symbol_ref "TARGET_SH3") (const_int 0))
+		   (not (match_test "TARGET_SH3"))
 		   (eq_attr "hit_stack" "no")
 		   (eq_attr "banked" "no"))))) (nil) (nil)])
 
@@ -580,7 +575,7 @@ (define_delay
 
 (define_delay
   (and (eq_attr "type" "cbranch")
-       (ne (symbol_ref "TARGET_SH2") (const_int 0)))
+       (match_test "TARGET_SH2"))
   ;; SH2e has a hardware bug that pretty much prohibits the use of
   ;; annuled delay slots.
   [(eq_attr "cond_delay_slot" "yes") (and (eq_attr "cond_delay_slot" "yes")
@@ -3478,7 +3473,7 @@ (define_insn "ashlsi3_n"
   "TARGET_SH1 && ! sh_dynamicalize_shift_p (operands[2])"
   "#"
   [(set (attr "length")
-	(cond [(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 1))
+	(cond [(match_test "shift_insns_rtx (insn)")
 	       (const_string "2")
 	       (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2))
 	       (const_string "4")
@@ -3544,7 +3539,7 @@ (define_insn "*ashlhi3_n"
   "TARGET_SH1"
   "#"
   [(set (attr "length")
-	(cond [(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 1))
+	(cond [(match_test "shift_insns_rtx (insn)")
 	       (const_string "2")
 	       (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2))
 	       (const_string "4")]
@@ -3780,7 +3775,7 @@ (define_insn "lshrsi3_n"
   "TARGET_SH1 && ! sh_dynamicalize_shift_p (operands[2])"
   "#"
   [(set (attr "length")
-	(cond [(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 1))
+	(cond [(match_test "shift_insns_rtx (insn)")
 	       (const_string "2")
 	       (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2))
 	       (const_string "4")
@@ -4201,7 +4196,7 @@ (define_insn "shl_sext_ext"
   "TARGET_SH1 && (unsigned)shl_sext_kind (operands[2], operands[3], 0) - 1 < 5"
   "#"
   [(set (attr "length")
-	(cond [(eq (symbol_ref "shl_sext_length (insn)") (const_int 1))
+	(cond [(match_test "shl_sext_length (insn)")
 	       (const_string "2")
 	       (eq (symbol_ref "shl_sext_length (insn)") (const_int 2))
 	       (const_string "4")
@@ -4377,7 +4372,7 @@ (define_insn "zero_extendhidi2"
 	ld%M1.uw	%m1, %0"
   [(set_attr "type" "*,load_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -4413,7 +4408,7 @@ (define_insn "zero_extendqidi2"
 	ld%M1.ub	%m1, %0"
   [(set_attr "type" "arith_media,load_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -4443,7 +4438,7 @@ (define_insn "*zero_extendhisi2_media"
 	ld%M1.uw	%m1, %0"
   [(set_attr "type" "arith_media,load_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -4490,7 +4485,7 @@ (define_insn "*zero_extendqisi2_media"
 	ld%M1.ub	%m1, %0"
   [(set_attr "type" "arith_media,load_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -4519,7 +4514,7 @@ (define_insn "extendsidi2"
 	fmov.sl	%1, %0"
   [(set_attr "type" "arith_media,load_media,fpconv_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "extend")))])
 
@@ -4532,7 +4527,7 @@ (define_insn "extendhidi2"
 	ld%M1.w	%m1, %0"
   [(set_attr "type" "*,load_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -4557,7 +4552,7 @@ (define_insn "extendqidi2"
 	ld%M1.b	%m1, %0"
   [(set_attr "type" "*,load_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -4597,7 +4592,7 @@ (define_insn "*extendhisi2_media"
 	ld%M1.w	%m1, %0"
   [(set_attr "type" "arith_media,load_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -4634,7 +4629,7 @@ (define_insn "*extendqisi2_compact"
    (set_attr_alternative "length"
      [(const_int 2)
        (if_then_else
-	(ne (symbol_ref "TARGET_SH2A") (const_int 0))
+	(match_test "TARGET_SH2A")
 	(const_int 4) (const_int 2))])])
 
 (define_insn "*extendqisi2_media"
@@ -4646,7 +4641,7 @@ (define_insn "*extendqisi2_media"
 	ld%M1.b	%m1, %0"
   [(set_attr "type" "arith_media,load_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -4677,7 +4672,7 @@ (define_insn "extendqihi2"
    (set_attr_alternative "length"
      [(const_int 2)
        (if_then_else
-	(ne (symbol_ref "TARGET_SH2A") (const_int 0))
+	(match_test "TARGET_SH2A")
 	(const_int 4) (const_int 2))])])
 
 /* It would seem useful to combine the truncXi patterns into the movXi
@@ -4696,7 +4691,7 @@ (define_insn "truncdisi2"
 	fmov.s	%T1, %0"
   [(set_attr "type"   "arith_media,store_media,fstore_media,fload_media,fpconv_media,fmove_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "extend")))])
 
@@ -4710,7 +4705,7 @@ (define_insn "truncdihi2"
   [(set_attr "type"   "arith_media,store_media")
    (set_attr "length" "8,4")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "extend")))])
 
@@ -4726,7 +4721,7 @@ (define_insn "truncdiqi2"
 	st%M0.b	%m0, %1"
   [(set_attr "type"   "arith_media,store")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "extend")))])
 ;; -------------------------------------------------------------------------
@@ -4937,13 +4932,13 @@ (define_insn "movsi_ie"
       (const_int 4)
       (const_int 2)
       (if_then_else
-	(ne (symbol_ref "TARGET_SH2A") (const_int 0))
+	(match_test "TARGET_SH2A")
 	(const_int 4) (const_int 2))
       (const_int 2)
       (const_int 2)
       (const_int 2)
       (if_then_else
-	(ne (symbol_ref "TARGET_SH2A") (const_int 0))
+	(match_test "TARGET_SH2A")
 	(const_int 4) (const_int 2))
       (const_int 2)
       (const_int 2)
@@ -5021,7 +5016,7 @@ (define_insn "*movsi_media"
   [(set_attr "type"   "arith_media,arith_media,*,load_media,store_media,fload_media,fstore_media,fload_media,fpconv_media,fmove_media,ptabs_media,gettr_media,pt_media")
    (set_attr "length" "4,4,8,4,4,4,4,4,4,4,4,4,12")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -5046,7 +5041,7 @@ (define_insn "*movsi_media_nofpu"
   [(set_attr "type"   "arith_media,arith_media,*,load_media,store_media,ptabs_media,gettr_media,pt_media")
    (set_attr "length" "4,4,8,4,4,4,4,12")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -5241,10 +5236,10 @@ (define_insn "movqi_i"
      [(const_int 2)
       (const_int 2)
       (if_then_else
-	(ne (symbol_ref "TARGET_SH2A") (const_int 0))
+	(match_test "TARGET_SH2A")
 	(const_int 4) (const_int 2))
       (if_then_else
-	(ne (symbol_ref "TARGET_SH2A") (const_int 0))
+	(match_test "TARGET_SH2A")
 	(const_int 4) (const_int 2))
       (const_int 2)
       (const_int 2)
@@ -5263,7 +5258,7 @@ (define_insn "*movqi_media"
 	st%M0.b	%m0, %N1"
   [(set_attr "type" "arith_media,arith_media,load_media,store_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -5325,7 +5320,7 @@ (define_insn "*movhi_media"
 	st%M0.w	%m0, %N1"
   [(set_attr "type" "arith_media,arith_media,*,load_media,store_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -5831,10 +5826,10 @@ (define_insn "movdf_i4"
       ;; We can't use 4-byte push/pop on SHcompact, so we have to
       ;; increment or decrement r15 explicitly.
       (if_then_else
-       (ne (symbol_ref "TARGET_SHCOMPACT") (const_int 0))
+       (match_test "TARGET_SHCOMPACT")
        (const_int 10) (const_int 8))
       (if_then_else
-       (ne (symbol_ref "TARGET_SHCOMPACT") (const_int 0))
+       (match_test "TARGET_SHCOMPACT")
        (const_int 10) (const_int 8))])
    (set_attr "type" "fmove,move,pcfload,fload,fstore,pcload,load,store,load,fload")
    (set_attr "late_fp_use" "*,*,*,*,yes,*,*,*,*,*")
@@ -6514,7 +6509,7 @@ (define_insn "movsf_media"
 	st%M0.l	%m0, %N1"
   [(set_attr "type" "fmove_media,fload_media,fpconv_media,arith_media,*,fload_media,fstore_media,load_media,store_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -6531,7 +6526,7 @@ (define_insn "movsf_media_nofpu"
 	st%M0.l	%m0, %N1"
   [(set_attr "type" "arith_media,*,load_media,store_media")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 
@@ -6623,17 +6618,17 @@ (define_insn "movsf_ie"
       (const_int 2)
       (const_int 4)
       (if_then_else
-	(ne (symbol_ref "TARGET_SH2A") (const_int 0))
+	(match_test "TARGET_SH2A")
 	(const_int 4) (const_int 2))
       (if_then_else
-	(ne (symbol_ref "TARGET_SH2A") (const_int 0))
+	(match_test "TARGET_SH2A")
 	(const_int 4) (const_int 2))
       (const_int 2)
       (if_then_else
-	(ne (symbol_ref "TARGET_SH2A") (const_int 0))
+	(match_test "TARGET_SH2A")
 	(const_int 4) (const_int 2))
       (if_then_else
-	(ne (symbol_ref "TARGET_SH2A") (const_int 0))
+	(match_test "TARGET_SH2A")
 	(const_int 4) (const_int 2))
       (const_int 2)
       (const_int 2)
@@ -11613,7 +11608,7 @@ (define_insn "movv2hi_i"
   [(set_attr "type"   "arith_media,arith_media,*,load_media,store_media")
    (set_attr "length" "4,4,16,4,4")
    (set (attr "highpart")
-	(cond [(ne (symbol_ref "sh_contains_memref_p (insn)") (const_int 0))
+	(cond [(match_test "sh_contains_memref_p (insn)")
 	       (const_string "user")]
 	      (const_string "ignore")))])
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]