Patchwork [8/N,frv] convert to fma

login
register
mail settings
Submitter Richard Henderson
Date Nov. 12, 2010, 3 a.m.
Message ID <20101112030059.GA14503@twiddle.net>
Download mbox | patch
Permalink /patch/70915/
State New
Headers show

Comments

Richard Henderson - Nov. 12, 2010, 3 a.m.
This is a guess.  The FR-V manual that I could find did not
include these instructions at all.

Therefore I presume that the -mmuladd option is actually an
ISA controling option, like the i386 -mfma option.  Therefore
that option should not be an alias for -ffp-convert.

Please double-check the logic of the instructions.


r~
Nick Clifton - Nov. 15, 2010, 12:49 p.m.
Hi Richard,

> This is a guess.  The FR-V manual that I could find did not
> include these instructions at all.

Agreed.  I do not have any documentation on these instructions either. 
I did find this:

   http://sourceware.org/cgen/gen-doc/frv-1-insn.html

Which does document the instructions, but I do not think that it can be 
taken as an authoritative source.

> Therefore I presume that the -mmuladd option is actually an
> ISA controling option, like the i386 -mfma option.  Therefore
> that option should not be an alias for -ffp-convert.

Yes, that is correct.

> Please double-check the logic of the instructions.

They are correct.  At least according to the descriptions on the 
sourceware.org website.

Cheers
   Nick

Patch

diff --git a/gcc/config/frv/frv.md b/gcc/config/frv/frv.md
index 2440d12..81b4b16 100644
--- a/gcc/config/frv/frv.md
+++ b/gcc/config/frv/frv.md
@@ -3274,21 +3274,21 @@ 
    (set_attr "type" "fsmul")])
 
 ;; Multiplication with addition/subtraction
-(define_insn "*muladdsf4"
+(define_insn "fmasf4"
   [(set (match_operand:SF 0 "fpr_operand" "=f")
-	(plus:SF (mult:SF (match_operand:SF 1 "fpr_operand" "%f")
-			  (match_operand:SF 2 "fpr_operand" "f"))
-		 (match_operand:SF 3 "fpr_operand" "0")))]
+	(fma:SF (match_operand:SF 1 "fpr_operand" "f")
+		(match_operand:SF 2 "fpr_operand" "f")
+		(match_operand:SF 3 "fpr_operand" "0")))]
   "TARGET_HARD_FLOAT && TARGET_MULADD"
   "fmadds %1,%2,%0"
   [(set_attr "length" "4")
    (set_attr "type" "fsmadd")])
 
-(define_insn "*mulsubsf4"
+(define_insn "fmssf4"
   [(set (match_operand:SF 0 "fpr_operand" "=f")
-	(minus:SF (mult:SF (match_operand:SF 1 "fpr_operand" "%f")
-			   (match_operand:SF 2 "fpr_operand" "f"))
-		  (match_operand:SF 3 "fpr_operand" "0")))]
+	(fma:SF (match_operand:SF 1 "fpr_operand" "f")
+		(match_operand:SF 2 "fpr_operand" "f")
+		(neg:SF (match_operand:SF 3 "fpr_operand" "0"))))]
   "TARGET_HARD_FLOAT && TARGET_MULADD"
   "fmsubs %1,%2,%0"
   [(set_attr "length" "4")