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]

[PATCH] Fix 'and' of mutually exclusive equal-tests is always 0 warnings in i386.md


Hi!

SWI iterator includes (DI "TARGET_64BIT") case, so when it is used together
with "TARGET_FUSE_CMP_AND_BRANCH && !TARGET_64BIT" conditional, we have
(TARGET_FUSE_CMP_AND_BRANCH && !TARGET_64BIT) && TARGET_64BIT for the DImode
jcc_fused_{1,2,3,4}.  That triggers the warning and is completely
unnecessary to be emitted altogether.  This patch fixes it by using a
different mode iterator, which kills the warning and removes the 4 insns
that have condition always false.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2008-09-09  Jakub Jelinek  <jakub@redhat.com>

	* config/i386/i386.md (SWI32): New mode iterator.
	(jcc_fused_1, jcc_fused_2, jcc_fused_3, jcc_fused_4): Use it instead
	of SWI.

--- gcc/config/i386/i386.md.jj	2008-09-09 21:14:25.000000000 +0200
+++ gcc/config/i386/i386.md	2008-09-09 21:56:46.000000000 +0200
@@ -652,6 +652,9 @@
 ;; All single word integer modes.
 (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")])
 
+;; Single word integer modes up to SImode.
+(define_mode_iterator SWI32 [QI HI SI])
+
 ;; Instruction suffix for integer modes.
 (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
 
@@ -14271,8 +14274,8 @@
 (define_insn "*jcc_fused_1"
   [(set (pc)
 	(if_then_else (match_operator 1 "comparison_operator"
-			[(match_operand:SWI 2 "register_operand" "<r>")
-			 (match_operand:SWI 3 "const0_operand" "")])
+			[(match_operand:SWI32 2 "register_operand" "<r>")
+			 (match_operand:SWI32 3 "const0_operand" "")])
 	 (label_ref (match_operand 0 "" ""))
 	 (pc)))]
   "TARGET_FUSE_CMP_AND_BRANCH && !TARGET_64BIT"
@@ -14286,8 +14289,8 @@
 (define_insn "*jcc_fused_2"
   [(set (pc)
 	(if_then_else (match_operator 1 "comparison_operator"
-			[(match_operand:SWI 2 "register_operand" "<r>")
-			 (match_operand:SWI 3 "const0_operand" "")])
+			[(match_operand:SWI32 2 "register_operand" "<r>")
+			 (match_operand:SWI32 3 "const0_operand" "")])
 	 (pc)
 	 (label_ref (match_operand 0 "" ""))))]
   "TARGET_FUSE_CMP_AND_BRANCH && !TARGET_64BIT"
@@ -14302,8 +14305,8 @@
   [(set (pc)
 	(if_then_else
 	  (match_operator 1 "ix86_comparison_uns_operator"
-	    [(match_operand:SWI 2 "nonimmediate_operand" "<r>,m,<r>")
-	     (match_operand:SWI 3 "<general_operand>" "<r><i>,<r>,m")])
+	    [(match_operand:SWI32 2 "nonimmediate_operand" "<r>,m,<r>")
+	     (match_operand:SWI32 3 "<general_operand>" "<r><i>,<r>,m")])
 	 (label_ref (match_operand 0 "" ""))
 	 (pc)))]
   "TARGET_FUSE_CMP_AND_BRANCH && !TARGET_64BIT
@@ -14320,8 +14323,8 @@
   [(set (pc)
 	(if_then_else
 	  (match_operator 1 "ix86_comparison_uns_operator"
-	    [(match_operand:SWI 2 "nonimmediate_operand" "<r>,m,<r>")
-	     (match_operand:SWI 3 "<general_operand>" "<r><i>,<r>,m")])
+	    [(match_operand:SWI32 2 "nonimmediate_operand" "<r>,m,<r>")
+	     (match_operand:SWI32 3 "<general_operand>" "<r><i>,<r>,m")])
 	 (pc)
 	 (label_ref (match_operand 0 "" ""))))]
   "TARGET_FUSE_CMP_AND_BRANCH && !TARGET_64BIT

	Jakub


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