This is the mail archive of the gcc@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]

Re: A patch for local register allocation.


> You might ask John Wehle if he could look at rewriting the x86 cmove
> patterns -- he's been doing excellent work in other areas of the
> x86 compiler.

Actually I made the mistake of starting to look at this last night
instead of going to bed. :-)  If someone could look over the enclosed
snippet of i386.md to make sure I'm on the right path I would appreciate
it.

(define_expand "movsicc"
  [(set (match_operand 0 "register_operand" "")
	(if_then_else:SI (match_operand 1 "comparison_operator" "")
			 (match_operand:SI 2 "general_operand" "")
			 (match_operand:SI 3 "general_operand" "")))]
  "TARGET_CMOVE"
  "
{
  operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
			GET_MODE (i386_compare_op0),
			i386_compare_op0, i386_compare_op1);
}")

(define_insn ""
  [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r")
	(if_then_else:SI (match_operator 1 "comparison_operator" 
				[(match_operand 2 "nonimmediate_operand" "")
				 (match_operand 3 "general_operand" "")])
		      (match_operand:SI 4 "general_operand" "rm,0,rm")
		      (match_operand:SI 5 "general_operand" "0,rm,rm")))]
  "TARGET_CMOVE"
  "#")

(define_split
  [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r")
	(if_then_else:SI (match_operator 1 "comparison_operator" 
				[(match_operand 2 "nonimmediate_operand" "")
				 (const_int 0)])
		      (match_operand:SI 3 "general_operand" "rm,0,rm")
		      (match_operand:SI 4 "general_operand" "0,rm,rm")))]
  "TARGET_CMOVE && reload_completed"
  [(set (cc0)
	(match_dup 2))
   (set (match_dup 0)
	(if_then_else:SI (match_op_dup 1 [(cc0) (const_int 0)])
		      (match_dup 3) (match_dup 4)))]
  "")

(define_split
  [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r")
	(if_then_else:SI (match_operator 1 "comparison_operator" 
				[(match_operand 2 "nonimmediate_operand" "")
				 (match_operand 3 "general_operand" "")])
		      (match_operand:SI 4 "general_operand" "rm,0,rm")
		      (match_operand:SI 5 "general_operand" "0,rm,rm")))]
  "TARGET_CMOVE && reload_completed"
  [(set (cc0) (compare (match_dup 2) (match_dup 3)))
   (set (match_dup 0)
	(if_then_else:SI (match_op_dup 1 [(cc0) (const_int 0)])
		      (match_dup 4) (match_dup 5)))]
  "")

(define_insn ""
  [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r")
	(if_then_else:SI (match_operator 1 "comparison_operator" 
				[(cc0) (const_int 0)])
		      (match_operand:SI 2 "general_operand" "rm,0,rm")
		      (match_operand:SI 3 "general_operand" "0,rm,rm")))]
  "TARGET_CMOVE && reload_completed"
  "*
{

  if (which_alternative == 0)
    {
      /* r <- cond ? arg : r */
      output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
    }
  else if (which_alternative == 1)
    {
      /* r <- cond ? r : arg */
      output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
    }
  else
    {
      /* r <- cond ? arg1 : arg2 */
      output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
      output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
    }

  RET;
}")

-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



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