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]

Re: ia64: more TImode arithmetic


On Tue, Jul 05, 2005 at 01:48:34AM -0600, Jan Beulich wrote:
>  (define_insn_and_split "*movti_internal"
> -  [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
> -	(match_operand:TI 1 "general_operand"      "ri,m,r"))]
> +  [(set (match_operand:TI 0 "nonimmediate_operand" "=r,   *fm,*x,*f,  Q")
> +	(match_operand:TI 1 "general_operand"      "r*fim,r,  Q, *fOQ,*f"))]
>    "ia64_move_ok (operands[0], operands[1])"
> -  "#"
> +  "ldfp8 %X0 = %1%P1"

I don't like using just the ldfp8 entry.  Using 

  "@
   #
   #
   #
   ldfp8 %X0 = %1%P1"

would properly abort if we hadn't split the pattern at the right place.

> +;; Since splitter results containing cond_exec-s can't be conditionalized
> +;; automatically in a way we'd be able to handle, we have to define these
> +;; explicitly.
> +;; However, the final insn splitting takes place prior to the final
> +;; if-conversion pass, and hence this insn will never survive, making it
> +;; and its (supposed) splitters useless.
> +;;(define_insn "*addti3_cond"

It's not clear to me what you were after here.  But I certainly don't want
you adding commented-out patterns.

> +(define_split
> +  [(set (match_operand:TI 0 "register_operand" "")
> +	(plus:TI (match_operand:TI 1 "register_operand" "")
> +		 (match_operand:TI 2 "immediate_operand" "")))
> +   (clobber (match_scratch:BI 3 ""))]
> +  "reload_completed && (unsigned HOST_WIDE_INT)INTVAL (operands[2]) < 0x2000"
> +  [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
> +   (set (match_dup 3) (ltu:BI (match_dup 0) (match_dup 1)))
> +   (cond_exec (eq (match_dup 3) (const_int 0))
> +	      (set (match_dup 4) (match_dup 5)))
> +   (cond_exec (ne (match_dup 3) (const_int 0))
> +	      (set (match_dup 4)
> +		   (plus:DI (match_dup 5) (const_int 1))))]
> +  "operands[4] = gen_highpart (DImode, operands[0]);
> +   operands[0] = gen_lowpart (DImode, operands[0]);
> +   operands[5] = gen_highpart (DImode, operands[1]);
> +   operands[1] = gen_lowpart (DImode, operands[1]);")
> +
> +(define_split
> +  [(set (match_operand:TI 0 "register_operand" "")
> +	(plus:TI (match_operand:TI 1 "register_operand" "")
> +		 (match_operand:TI 2 "immediate_operand" "")))
> +   (clobber (match_scratch:BI 3 ""))]
> +  "reload_completed && INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -0x2000"
> +  [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
> +   (set (match_dup 3) (ltu:BI (match_dup 0) (match_dup 1)))
> +   (cond_exec (eq (match_dup 3) (const_int 0))
> +	      (set (match_dup 4)
> +		   (plus:DI (match_dup 5) (const_int -1))))
> +   (cond_exec (ne (match_dup 3) (const_int 0))
> +	      (set (match_dup 4) (match_dup 5)))]
> +  "operands[4] = gen_highpart (DImode, operands[0]);
> +   operands[0] = gen_lowpart (DImode, operands[0]);
> +   operands[5] = gen_highpart (DImode, operands[1]);
> +   operands[1] = gen_lowpart (DImode, operands[1]);")

You can merge these two by 

 operands[6] = INTVAL (operands[2]) < 0 ? constm1_rtx : const1_rtx;

You should prefer { } quoting over "" quoting for C code.



r~


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