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 unarry operations patterns revmap


Hi
The binarry operators use ix86_expand_binary_operator in expanders
to ensure that insn looks like some real opcode. Then the
ix86_binary_operator_ok checks that this invariant holds during compilation.

I386.c seems to contain same infrastructure for unary operators, but
it is outdated and unused. This patch brings it back to live.
I am not sure if it is worthwhile (it makes just very small changes
on cc1 - about 0.5kb in size), but it is probably cleaner to use similar
infrastructure for both cases.
But if you prefer, I can just come with patch to remove those
functions from i386.c.

I've also added slightly more strict check for memory operands
to binarry_operator_ok.

Fri Nov 19 15:58:16 CET 1999  Jan Hubicka  <hubicka@freesoft.cz>

	* i386.md (neg, not and abs patterns): Revmap to use
	ix86_expand_unary_operator and ix86_unary_operator_ok.
	* i386.c (ix86_expand_unary_operator): Rewrite.
	(ix86_unary_operator_ok): Ensure that memory operands
	match real opcode.
	(ix86_binary_operator_ok): Do not allow operand 1 to
	come into memory and operand 0 not.

*** i386.md.noc2	Fri Nov 19 12:02:39 1999
--- i386.md	Fri Nov 19 13:48:13 1999
***************
*** 4818,4828 ****
  
  ;; %%% define_expand from the very first?
  
! (define_insn "negdi2"
    [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
  	(neg:DI (match_operand:DI 1 "general_operand" "0")))
     (clobber (reg:CC 17))]
!   ""
    "#")
  
  (define_split
--- 4818,4835 ----
  
  ;; %%% define_expand from the very first?
  
! (define_expand "negdi2"
!   [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "")
! 		   (neg:DI (match_operand:DI 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   ""
!   "ix86_expand_unary_operator (NEG, DImode, operands); DONE;")
! 
! (define_insn "*negdi2_1"
    [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
  	(neg:DI (match_operand:DI 1 "general_operand" "0")))
     (clobber (reg:CC 17))]
!   "ix86_unary_operator_ok (NEG, DImode, operands)"
    "#")
  
  (define_split
***************
*** 4847,4857 ****
    "split_di (operands+1, 1, operands+2, operands+3);
     split_di (operands+0, 1, operands+0, operands+1);")
  
! (define_insn "negsi2"
    [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(neg:SI (match_operand:SI 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   ""
    "neg{l}\\t%0"
    [(set_attr "type" "negnot")])
  
--- 4854,4871 ----
    "split_di (operands+1, 1, operands+2, operands+3);
     split_di (operands+0, 1, operands+0, operands+1);")
  
! (define_expand "negsi2"
!   [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
! 		   (neg:SI (match_operand:SI 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   ""
!   "ix86_expand_unary_operator (NEG, SImode, operands); DONE;")
! 
! (define_insn "*negsi2_1"
    [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(neg:SI (match_operand:SI 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "ix86_unary_operator_ok (NEG, SImode, operands)"
    "neg{l}\\t%0"
    [(set_attr "type" "negnot")])
  
***************
*** 4861,4867 ****
  		 (const_int 0)))
     (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(neg:SI (match_dup 1)))]
!   ""
    "neg{l}\\t%0"
    [(set_attr "type" "negnot")])
  
--- 4875,4881 ----
  		 (const_int 0)))
     (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(neg:SI (match_dup 1)))]
!   "ix86_unary_operator_ok (NEG, SImode, operands)"
    "neg{l}\\t%0"
    [(set_attr "type" "negnot")])
  
***************
*** 4871,4885 ****
  		 (const_int 0)))
     (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(neg:SI (match_dup 1)))]
!   ""
    "neg{l}\\t%0"
    [(set_attr "type" "negnot")])
  
! (define_insn "neghi2"
    [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(neg:HI (match_operand:HI 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   ""
    "neg{w}\\t%0"
    [(set_attr "type" "negnot")])
  
--- 4885,4906 ----
  		 (const_int 0)))
     (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(neg:SI (match_dup 1)))]
!   "ix86_unary_operator_ok (NEG, SImode, operands)"
    "neg{l}\\t%0"
    [(set_attr "type" "negnot")])
  
! (define_expand "neghi2"
!   [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
! 		   (neg:HI (match_operand:HI 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   ""
!   "ix86_expand_unary_operator (NEG, HImode, operands); DONE;")
! 
! (define_insn "*neghi2_1"
    [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(neg:HI (match_operand:HI 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "ix86_unary_operator_ok (NEG, HImode, operands)"
    "neg{w}\\t%0"
    [(set_attr "type" "negnot")])
  
***************
*** 4889,4895 ****
  		 (const_int 0)))
     (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(neg:HI (match_dup 1)))]
!   ""
    "neg{w}\\t%0"
    [(set_attr "type" "negnot")])
  
--- 4910,4916 ----
  		 (const_int 0)))
     (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(neg:HI (match_dup 1)))]
!   "ix86_unary_operator_ok (NEG, HImode, operands)"
    "neg{w}\\t%0"
    [(set_attr "type" "negnot")])
  
***************
*** 4899,4913 ****
  		 (const_int 0)))
     (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(neg:HI (match_dup 1)))]
!   ""
    "neg{w}\\t%0"
    [(set_attr "type" "negnot")])
  
! (define_insn "negqi2"
    [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
  	(neg:QI (match_operand:QI 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   ""
    "neg{b}\\t%0"
    [(set_attr "type" "negnot")])
  
--- 4920,4941 ----
  		 (const_int 0)))
     (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(neg:HI (match_dup 1)))]
!   "ix86_unary_operator_ok (NEG, HImode, operands)"
    "neg{w}\\t%0"
    [(set_attr "type" "negnot")])
  
! (define_expand "negqi2"
!   [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
! 		   (neg:QI (match_operand:QI 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   ""
!   "ix86_expand_unary_operator (NEG, QImode, operands); DONE;")
! 
! (define_insn "*negqi2_1"
    [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
  	(neg:QI (match_operand:QI 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "ix86_unary_operator_ok (NEG, QImode, operands)"
    "neg{b}\\t%0"
    [(set_attr "type" "negnot")])
  
***************
*** 4917,4923 ****
  		 (const_int 0)))
     (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
  	(neg:QI (match_dup 1)))]
!   ""
    "neg{b}\\t%0"
    [(set_attr "type" "negnot")])
  
--- 4945,4951 ----
  		 (const_int 0)))
     (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
  	(neg:QI (match_dup 1)))]
!   "ix86_unary_operator_ok (NEG, QImode, operands)"
    "neg{b}\\t%0"
    [(set_attr "type" "negnot")])
  
***************
*** 4927,4943 ****
  		 (const_int 0)))
     (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
  	(neg:QI (match_dup 1)))]
!   ""
    "neg{b}\\t%0"
    [(set_attr "type" "negnot")])
  
! ;; Changing of sign for FP values is duable using integer unit too.
  
! (define_insn "negsf2"
    [(set (match_operand:SF 0 "nonimmediate_operand" "=frm")
  	(neg:SF (match_operand:SF 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "TARGET_80387"
    "#")
  
  (define_split
--- 4955,4978 ----
  		 (const_int 0)))
     (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
  	(neg:QI (match_dup 1)))]
!   "ix86_unary_operator_ok (NEG, QImode, operands)"
    "neg{b}\\t%0"
    [(set_attr "type" "negnot")])
  
! ;; Changing of sign for FP values is doable using integer unit too.
  
! (define_expand "negsf2"
!   [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
! 		   (neg:SF (match_operand:SF 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   "TARGET_80387"
!   "ix86_expand_unary_operator (NEG, SFmode, operands); DONE;")
! 
! (define_insn "*negsf2_if"
    [(set (match_operand:SF 0 "nonimmediate_operand" "=frm")
  	(neg:SF (match_operand:SF 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "TARGET_80387 && ix86_unary_operator_ok (NEG, SFmode, operands)"
    "#")
  
  (define_split
***************
*** 4978,4988 ****
    operands[1] = GEN_INT (0x80);
  }")
  
! (define_insn "negdf2"
    [(set (match_operand:DF 0 "nonimmediate_operand" "=frm")
  	(neg:DF (match_operand:DF 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "TARGET_80387"
    "#")
  
  (define_split
--- 5013,5030 ----
    operands[1] = GEN_INT (0x80);
  }")
  
! (define_expand "negdf2"
!   [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
! 		   (neg:DF (match_operand:DF 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   "TARGET_80387"
!   "ix86_expand_unary_operator (NEG, DFmode, operands); DONE;")
! 
! (define_insn "*negdf2_if"
    [(set (match_operand:DF 0 "nonimmediate_operand" "=frm")
  	(neg:DF (match_operand:DF 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "TARGET_80387 && ix86_unary_operator_ok (NEG, DFmode, operands)"
    "#")
  
  (define_split
***************
*** 5004,5014 ****
    "operands[4] = GEN_INT (0x80000000);
     split_di (operands+0, 1, operands+2, operands+3);")
  
! (define_insn "negxf2"
    [(set (match_operand:XF 0 "nonimmediate_operand" "=frm")
  	(neg:XF (match_operand:XF 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "TARGET_80387"
    "#")
  
  (define_split
--- 5046,5063 ----
    "operands[4] = GEN_INT (0x80000000);
     split_di (operands+0, 1, operands+2, operands+3);")
  
! (define_expand "negxf2"
!   [(parallel [(set (match_operand:XF 0 "nonimmediate_operand" "")
! 		   (neg:XF (match_operand:XF 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   "TARGET_80387"
!   "ix86_expand_unary_operator (NEG, XFmode, operands); DONE;")
! 
! (define_insn "*negxf2_if"
    [(set (match_operand:XF 0 "nonimmediate_operand" "=frm")
  	(neg:XF (match_operand:XF 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "TARGET_80387 && ix86_unary_operator_ok (NEG, XFmode, operands)"
    "#")
  
  (define_split
***************
*** 5086,5096 ****
  
  ;; Absolute value instructions
  
! (define_insn "abssf2"
    [(set (match_operand:SF 0 "nonimmediate_operand" "=frm")
  	(abs:SF (match_operand:SF 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "TARGET_80387"
    "#")
  
  (define_split
--- 5135,5152 ----
  
  ;; Absolute value instructions
  
! (define_expand "abssf2"
!   [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
! 		   (neg:SF (match_operand:SF 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   "TARGET_80387"
!   "ix86_expand_unary_operator (ABS, SFmode, operands); DONE;")
! 
! (define_insn "*abssf2_if"
    [(set (match_operand:SF 0 "nonimmediate_operand" "=frm")
  	(abs:SF (match_operand:SF 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "TARGET_80387 && ix86_unary_operator_ok (ABS, SFmode, operands)"
    "#")
  
  (define_split
***************
*** 5131,5140 ****
    operands[1] = GEN_INT (~0x80);
  }")
  
! (define_insn "absdf2"
    [(set (match_operand:DF 0 "nonimmediate_operand" "=frm")
  	(abs:DF (match_operand:DF 1 "nonimmediate_operand" "0")))]
!   "TARGET_80387"
    "#")
  
  (define_split
--- 5187,5203 ----
    operands[1] = GEN_INT (~0x80);
  }")
  
! (define_expand "absdf2"
!   [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "")
! 		   (neg:DF (match_operand:DF 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   "TARGET_80387"
!   "ix86_expand_unary_operator (ABS, DFmode, operands); DONE;")
! 
! (define_insn "*absdf2_if"
    [(set (match_operand:DF 0 "nonimmediate_operand" "=frm")
  	(abs:DF (match_operand:DF 1 "nonimmediate_operand" "0")))]
!   "TARGET_80387 && ix86_unary_operator_ok (ABS, DFmode, operands)"
    "#")
  
  (define_split
***************
*** 5156,5166 ****
    "operands[4] = GEN_INT (~0x80000000);
     split_di (operands+0, 1, operands+2, operands+3);")
  
! (define_insn "absxf2"
    [(set (match_operand:XF 0 "nonimmediate_operand" "=frm")
  	(abs:XF (match_operand:XF 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "TARGET_80387"
    "#")
  
  (define_split
--- 5219,5236 ----
    "operands[4] = GEN_INT (~0x80000000);
     split_di (operands+0, 1, operands+2, operands+3);")
  
! (define_expand "absxf2"
!   [(parallel [(set (match_operand:XF 0 "nonimmediate_operand" "")
! 		   (neg:XF (match_operand:XF 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   "TARGET_80387"
!   "ix86_expand_unary_operator (ABS, XFmode, operands); DONE;")
! 
! (define_insn "*absxf2_if"
    [(set (match_operand:XF 0 "nonimmediate_operand" "=frm")
  	(abs:XF (match_operand:XF 1 "nonimmediate_operand" "0")))
     (clobber (reg:CC 17))]
!   "TARGET_80387 && ix86_unary_operator_ok (ABS, XFmode, operands)"
    "#")
  
  (define_split
***************
*** 5229,5248 ****
  
  ;; One complement instructions
  
! (define_insn "one_cmplsi2"
    [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
!   ""
    "not{l}\\t%0"
    [(set_attr "type" "negnot")])
  
! (define_insn "*one_cmplsi2_1"
    [(set (reg:CCNO 17)
  	(compare:CCNO (not:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
  		    (const_int 0)))
     (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(not:SI (match_dup 1)))]
!   ""
    "#"
    [(set_attr "type" "alu1")])
  
--- 5299,5325 ----
  
  ;; One complement instructions
  
! (define_expand "one_cmplsi2"
!   [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "")
! 		   (not:SI (match_operand:SI 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   ""
!   "ix86_expand_unary_operator (NOT, SImode, operands); DONE;")
! 
! (define_insn "*one_cmplsi2_1"
    [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
!   "ix86_unary_operator_ok (NEG, SImode, operands)"
    "not{l}\\t%0"
    [(set_attr "type" "negnot")])
  
! (define_insn "*one_cmplsi2_2"
    [(set (reg:CCNO 17)
  	(compare:CCNO (not:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
  		    (const_int 0)))
     (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(not:SI (match_dup 1)))]
!   "ix86_unary_operator_ok (NEG, SImode, operands)"
    "#"
    [(set_attr "type" "alu1")])
  
***************
*** 5260,5269 ****
  		   (xor:SI (match_dup 1) (const_int -1)))])]
    "")
  
! (define_insn "one_cmplhi2"
    [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
!   ""
    "not{w}\\t%0"
    [(set_attr "type" "negnot")])
  
--- 5337,5353 ----
  		   (xor:SI (match_dup 1) (const_int -1)))])]
    "")
  
! (define_expand "one_cmplhi2"
!   [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
! 		   (not:HI (match_operand:HI 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   ""
!   "ix86_expand_unary_operator (NOT, HImode, operands); DONE;")
! 
! (define_insn "*one_cmplhi2_1"
    [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
!   "ix86_unary_operator_ok (NEG, HImode, operands)"
    "not{w}\\t%0"
    [(set_attr "type" "negnot")])
  
***************
*** 5277,5289 ****
    "operands[0] = gen_lowpart (SImode, operands[0]);
     operands[1] = gen_lowpart (SImode, operands[1]);")
  
! (define_insn "*one_cmplhi2_1"
    [(set (reg:CCNO 17)
  	(compare:CCNO (not:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
  		      (const_int 0)))
     (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(not:HI (match_dup 1)))]
!   ""
    "#"
    [(set_attr "type" "alu1")])
  
--- 5361,5373 ----
    "operands[0] = gen_lowpart (SImode, operands[0]);
     operands[1] = gen_lowpart (SImode, operands[1]);")
  
! (define_insn "*one_cmplhi2_2"
    [(set (reg:CCNO 17)
  	(compare:CCNO (not:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
  		      (const_int 0)))
     (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(not:HI (match_dup 1)))]
!   "ix86_unary_operator_ok (NEG, HImode, operands)"
    "#"
    [(set_attr "type" "alu1")])
  
***************
*** 5302,5323 ****
    "")
  
  ;; %%% Potential partial reg stall on alternative 1.  What to do?
! (define_insn "one_cmplqi2"
    [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,*r")
  	(not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
!   ""
    "@
     not{b}\\t%0
     not{l}\\t%k0"
    [(set_attr "type" "negnot")])
  
! (define_insn "*one_cmplqi2_1"
    [(set (reg:CCNO 17)
  	(compare:CCNO (not:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
  		    (const_int 0)))
     (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
  	(not:QI (match_dup 1)))]
!   ""
    "#"
    [(set_attr "type" "alu1")])
  
--- 5386,5414 ----
    "")
  
  ;; %%% Potential partial reg stall on alternative 1.  What to do?
! (define_expand "one_cmplqi2"
!   [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
! 		   (not:QI (match_operand:QI 1 "general_operand" "")))
! 	      (clobber (reg:CC 17))])]
!   ""
!   "ix86_expand_unary_operator (NOT, QImode, operands); DONE;")
! 
! (define_insn "*one_cmplqi2_1"
    [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,*r")
  	(not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
!   "ix86_unary_operator_ok (NEG, QImode, operands)"
    "@
     not{b}\\t%0
     not{l}\\t%k0"
    [(set_attr "type" "negnot")])
  
! (define_insn "*one_cmplqi2_2"
    [(set (reg:CCNO 17)
  	(compare:CCNO (not:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
  		    (const_int 0)))
     (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
  	(not:QI (match_dup 1)))]
!   "ix86_unary_operator_ok (NEG, QImode, operands)"
    "#"
    [(set_attr "type" "alu1")])
  
*** i386.c.noc	Thu Nov 18 06:36:16 1999
--- i386.c	Fri Nov 19 13:43:52 1999
*************** ix86_binary_operator_ok (code, mode, ope
*** 3763,3768 ****
--- 3784,3795 ----
  	    || (GET_RTX_CLASS (code) == 'c'
  		&& rtx_equal_p (operands[0], operands[2]))))
      return 0;
+   /* If the operation is not commutable and the source 1 is memory, we must
+      have a matching destionation.  */
+   if (GET_CODE (operands[1]) == MEM
+       && GET_RTX_CLASS (code) != 'c'
+       && ! rtx_equal_p (operands[0], operands[1]))
+     return 0;
    return 1;
  }
  
*************** ix86_expand_unary_operator (code, mode, 
*** 3777,3803 ****
       enum machine_mode mode;
       rtx operands[];
  {
!   /* If optimizing, copy to regs to improve CSE */
!   if (optimize
!       && ((reload_in_progress | reload_completed) == 0)
!       && GET_CODE (operands[1]) == MEM)
!     operands[1] = force_reg (GET_MODE (operands[1]), operands[1]);
! 
!   if (! ix86_unary_operator_ok (code, mode, operands))
!     {
!       if (optimize == 0
! 	  && ((reload_in_progress | reload_completed) == 0)
! 	  && GET_CODE (operands[1]) == MEM)
! 	{
! 	  operands[1] = force_reg (GET_MODE (operands[1]), operands[1]);
! 	  if (! ix86_unary_operator_ok (code, mode, operands))
! 	    return FALSE;
! 	}
        else
! 	return FALSE;
      }
  
!   return TRUE;
  }
  
  /* Return TRUE or FALSE depending on whether the unary operator meets the
--- 3804,3855 ----
       enum machine_mode mode;
       rtx operands[];
  {
!   int matching_memory;
!   rtx src, dst, op, clob;
! 
!   dst = operands[0];
!   src = operands[1];
! 
!   /* If the destination is memory, and we do not have matching source
!      operands, do things in registers.  */
!   matching_memory = 0;
!   if (GET_CODE (dst) == MEM)
!     {
!       if (rtx_equal_p (dst, src))
! 	matching_memory = 1;
        else
! 	dst = gen_reg_rtx (mode);
!     }
!   
!   /* If optimizing, copy to regs to improve CSE */
!   if (optimize && !reload_in_progress && !reload_completed)
!     {
!       if (GET_CODE (dst) == MEM)
! 	dst = gen_reg_rtx (mode);
!       if (GET_CODE (src) == MEM)
! 	src = force_reg (mode, src);
      }
  
!   /* Emit the instruction.  */
! 
!   op = gen_rtx_SET (VOIDmode, dst, gen_rtx_fmt_e (code, mode, src));
!   if (reload_in_progress || code == NOT)
!     {
!       /* Reload doesn't know about the flags register, and doesn't know that
!          it doesn't want to clobber it.  */
!       if (code != NOT)
!         abort ();
!       emit_insn (op);
!     }
!   else
!     {
!       clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
!       emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, op, clob)));
!     }
! 
!   /* Fix up the destination if needed.  */
!   if (dst != operands[0])
!     emit_move_insn (operands[0], dst);
  }
  
  /* Return TRUE or FALSE depending on whether the unary operator meets the
*************** ix86_unary_operator_ok (code, mode, oper
*** 3809,3814 ****
--- 3861,3871 ----
       enum machine_mode mode ATTRIBUTE_UNUSED;
       rtx operands[2] ATTRIBUTE_UNUSED;
  {
+   /* If one of operands is memory, source and destination must match.  */
+   if ((GET_CODE (operands[0]) == MEM
+        || GET_CODE (operands[1]) == MEM)
+       && ! rtx_equal_p (operands[0], operands[1]))
+     return FALSE;
    return TRUE;
  }
  


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