Patchwork Backport patches that are correctness or performance bug fixes for latest AMD/Intel hardware.

login
register
mail settings
Submitter harsha.jagasia@amd.com
Date June 29, 2011, 4:03 p.m.
Message ID <20110629160354.2895.50678.sendpatchset@gccpike4.amd.com>
Download mbox | patch
Permalink /patch/102622/
State New
Headers show

Comments

harsha.jagasia@amd.com - June 29, 2011, 4:03 p.m.
Is it ok to commit backported patch from trunk below to gcc 4.6 as long as
bootstrap and tests pass (ongoing)? This is one of the patches that is
significant enough a bug for recent AMD and Intel hardware.

2011-06-29 Harsha Jagasia <harsha.jagasia@amd.com>
        Backport from mainline
	
	2011-05-31  Alexandre Oliva  <aoliva@redhat.com>

	* config/i386/i386.c (ix86_rtx_costs): Drop NEG from sub for FMA.
	* config/i386/sse.md: Add n to negated FMA pattern names.
Jakub Jelinek - June 29, 2011, 4:19 p.m.
On Wed, Jun 29, 2011 at 11:03:55AM -0500, harsha.jagasia@amd.com wrote:
> Is it ok to commit backported patch from trunk below to gcc 4.6 as long as
> bootstrap and tests pass (ongoing)? This is one of the patches that is
> significant enough a bug for recent AMD and Intel hardware.

Yeah, this is ok for 4.6.

> 2011-06-29 Harsha Jagasia <harsha.jagasia@amd.com>
>         Backport from mainline
> 	
> 	2011-05-31  Alexandre Oliva  <aoliva@redhat.com>
> 
> 	* config/i386/i386.c (ix86_rtx_costs): Drop NEG from sub for FMA.
> 	* config/i386/sse.md: Add n to negated FMA pattern names.

	Jakub

Patch

Index: config/i386/sse.md
===================================================================
--- config/i386/sse.md	(revision 175646)
+++ config/i386/sse.md	(working copy)
@@ -2130,7 +2130,7 @@  (define_insn "*fma_fmsub_<mode>"
   [(set_attr "type" "ssemuladd")
    (set_attr "mode" "<MODE>")])
 
-(define_insn "*fma_fmadd_<mode>"
+(define_insn "*fma_fnmadd_<mode>"
   [(set (match_operand:FMAMODE 0 "register_operand" "=x,x,x")
 	(fma:FMAMODE
 	  (neg:FMAMODE
@@ -2145,7 +2145,7 @@  (define_insn "*fma_fmadd_<mode>"
   [(set_attr "type" "ssemuladd")
    (set_attr "mode" "<MODE>")])
 
-(define_insn "*fma_fmsub_<mode>"
+(define_insn "*fma_fnmsub_<mode>"
   [(set (match_operand:FMAMODE 0 "register_operand" "=x,x,x")
 	(fma:FMAMODE
 	  (neg:FMAMODE
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 175646)
+++ config/i386/i386.c	(working copy)
@@ -29081,12 +29081,12 @@  ix86_rtx_costs (rtx x, int code, int out
         /* Negate in op0 or op2 is free: FMS, FNMA, FNMS.  */
 	sub = XEXP (x, 0);
 	if (GET_CODE (sub) == NEG)
-	  sub = XEXP (x, 0);
+	  sub = XEXP (sub, 0);
 	*total += rtx_cost (sub, FMA, speed);
 
 	sub = XEXP (x, 2);
 	if (GET_CODE (sub) == NEG)
-	  sub = XEXP (x, 0);
+	  sub = XEXP (sub, 0);
 	*total += rtx_cost (sub, FMA, speed);
 	return true;
       }