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]

i386 hi/qi move tweaks


Hi
This patch avoids partial register stalls in promoted code. The code was
present in my original patch, but accidentally got lost when I was splitting
it to more independent patches.

Honza

Wed Mar 22 10:00:34 CET 2000  Jan Hubicka  <jh@suse.cz>
	* i386.md (movhi_1): Use fullsized imovs when !TARGET_HIMODE_MATH
	(movqi_1): Likewise, do not use movzx when not necesary.
*** i386.md.old	Tue Mar 21 17:30:54 2000
--- i386.md	Wed Mar 22 09:57:39 2000
***************
*** 1399,1406 ****
  }"
    [(set (attr "type")
       (cond [(and (eq_attr "alternative" "0")
! 		 (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
! 		     (const_int 0)))
  	      (const_string "imov")
  	    (and (eq_attr "alternative" "1,2")
  		 (match_operand:HI 1 "aligned_operand" ""))
--- 1399,1408 ----
  }"
    [(set (attr "type")
       (cond [(and (eq_attr "alternative" "0")
! 		 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
! 			  (const_int 0))
! 		      (eq (symbol_ref "TARGET_HIMODE_MATH")
! 			  (const_int 0))))
  	      (const_string "imov")
  	    (and (eq_attr "alternative" "1,2")
  		 (match_operand:HI 1 "aligned_operand" ""))
***************
*** 1417,1425 ****
  	     (and (eq_attr "alternative" "1,2")
  		  (match_operand:HI 1 "aligned_operand" ""))
  	       (const_string "0")
! 	     (and (eq_attr "alternative" "0")
! 		  (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
! 		      (const_int 0)))
  	       (const_string "0")
  	    ]
  	    (const_string "1")))
--- 1419,1429 ----
  	     (and (eq_attr "alternative" "1,2")
  		  (match_operand:HI 1 "aligned_operand" ""))
  	       (const_string "0")
! 	     (and (eq_attr "alternative" "1,2")
! 		  (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
! 			   (const_int 0))
! 		       (eq (symbol_ref "TARGET_HIMODE_MATH")
! 			   (const_int 0))))
  	       (const_string "0")
  	    ]
  	    (const_string "1")))
***************
*** 1510,1517 ****
     (set_attr "length_prefix" "1")])
  
  (define_insn "*movqi_1"
!   [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q,r,?r,m")
! 	(match_operand:QI 1 "general_operand" "qn,qm,rn,qm,qn"))]
    "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
    "*
  {
--- 1514,1521 ----
     (set_attr "length_prefix" "1")])
  
  (define_insn "*movqi_1"
!   [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
! 	(match_operand:QI 1 "general_operand"      " q,qn,qm,q,rn,qm,qn"))]
    "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
    "*
  {
***************
*** 1522,1547 ****
  	abort ();
        return \"movz{bl|x}\\t{%1, %k0|%k0, %1}\";
      default:
!       if (which_alternative == 2)
          return \"mov{l}\\t{%k1, %k0|%k0, %k1}\";
        else
          return \"mov{b}\\t{%1, %0|%0, %1}\";
      }
  }"
    [(set (attr "type")
!      (cond [(eq_attr "alternative" "3")
  	      (const_string "imovx")
  	    (and (ne (symbol_ref "TARGET_MOVX")
  		     (const_int 0))
! 		 (eq_attr "alternative" "1"))
  	      (const_string "imovx")
  	   ]
  	   (const_string "imov")))
      ; There's no place to override just the immediate length
      (set (attr "length")
        (cond [(and (eq_attr "type" "imov")
! 		  (and (eq_attr "alternative" "2")
! 		       (match_operand:HI 1 "immediate_operand" "")))
  	       (const_string "5")
  	    ]
  	    (const_string "*")))])
--- 1526,1565 ----
  	abort ();
        return \"movz{bl|x}\\t{%1, %k0|%k0, %1}\";
      default:
!       if (which_alternative == 4 || which_alternative == 3
! 	  || (which_alternative == 1 && get_attr_length_prefix (insn) == 0)
! 	  || (which_alternative == 0
! 	      && TARGET_PARTIAL_REG_STALL && !TARGET_QIMODE_MATH))
          return \"mov{l}\\t{%k1, %k0|%k0, %k1}\";
        else
          return \"mov{b}\\t{%1, %0|%0, %1}\";
      }
  }"
    [(set (attr "type")
!      (cond [(and (eq_attr "alternative" "3")
! 		 (ior (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
! 			  (const_int 0))
! 		      (eq (symbol_ref "TARGET_QIMODE_MATH")
! 			  (const_int 0))))
! 	      (const_string "imov")
! 	    (eq_attr "alternative" "3,5")
  	      (const_string "imovx")
  	    (and (ne (symbol_ref "TARGET_MOVX")
  		     (const_int 0))
! 		 (eq_attr "alternative" "0,2"))
  	      (const_string "imovx")
  	   ]
  	   (const_string "imov")))
      ; There's no place to override just the immediate length
      (set (attr "length")
        (cond [(and (eq_attr "type" "imov")
! 		  (and (match_operand:HI 1 "immediate_operand" "")
! 		       (ior (eq_attr "alternative" "4")
! 			    (and (eq_attr "alternative" "1")
! 				 (and (ne (symbol_ref "TARGET_PARTIAL_REG_STALL")
! 					  (const_int 0))
! 				      (eq (symbol_ref "TARGET_QIMODE_MATH")
! 					  (const_int 0)))))))
  	       (const_string "5")
  	    ]
  	    (const_string "*")))])

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