This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, ia64] Add fma insn patterns
- From: Richard Henderson <rth at redhat dot com>
- To: "gcc-patches >> GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Cc: sje at cup dot hp dot com, rguenther at suse dot de
- Date: Mon, 18 Oct 2010 12:15:56 -0700
- Subject: Re: [PATCH, ia64] Add fma insn patterns
- References: <4CBC9481.808@redhat.com>
> +;; 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~