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: [PATCH, ia64] Add fma insn patterns


> +;; This insn is officially "-(a * b) + c" which is "-((a * b) - c)",
> +;; except for the sign of a zero result.  E.g.
> +;;	-(1 * 0) + 0 => -(0) + 0 => -0 + 0 => +0
> +;;	-((1 * 0) - 0) => -(0 - 0) => -(0) => -0
> +(define_insn "*nfmssf4"
> +  [(set (match_operand:SF 0 "fr_register_operand" "=f")
> +	(neg:SF
> +	 (fma:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
> +		 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
> +		 (neg:SF
> +		  (match_operand:SF 3 "fr_reg_or_signed_fp01_operand" "fZ")))))]
> +  "!flag_signed_zeros"
> +  "fnma.s %0 = %F1, %F2, %F3"
> +  [(set_attr "itanium_class" "fmac")])

I'm not sure why I didn't see it before but

  -(a * b) + c

simplifies better to 

  (-a) * b + c

i.e.

  [(set (match_operand 0)
	(fma (neg (match_operand 1))
	     (match_operand 2)
	     (match_operand 3)))]

I could either replace the pattern above (assuming that some simplification
routine could be induced to handle it), or leave it and add the new pattern.

Thoughts?


r~


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