Backport: fma3 instruction generation for 'march=native' in AMD processors

Submitted by Gopalasubramanian, Ganesh on May 9, 2012, 10:26 a.m.

Details

Message ID EB4625145972F94C9680D8CADD65161507312104@sausexdag04.amd.com
State New
Headers show

Commit Message

Gopalasubramanian, Ganesh May 9, 2012, 10:26 a.m.
Hello,

Below is the patch that has been committed in trunk (Revision: 187075).
We like to backport it to GCC 4.7 branch as couple of AMD processors require this change for fma3 instruction generation.

Bootstrapping and testing are successful. 

Is it OK to commit in GCC 4.7 branch?

Regards
Ganesh

PATCH

Patch hide | download patch | download mbox

=====

      * config/i386/driver-i386.c (host_detect_local_cpu): Reset
      has_fma4 for AMD processors with both fma3 and fma4 support.

Index: config/i386/driver-i386.c
===================================================================
--- config/i386/driver-i386.c   (revision 186897)
+++ config/i386/driver-i386.c   (working copy)
@@ -472,6 +472,8 @@ 
       has_abm = ecx & bit_ABM;
       has_lwp = ecx & bit_LWP;
       has_fma4 = ecx & bit_FMA4;
+      if (vendor == SIG_AMD && has_fma4 && has_fma)
+       has_fma4 = 0;
       has_xop = ecx & bit_XOP;
       has_tbm = ecx & bit_TBM;
       has_lzcnt = ecx & bit_LZCNT;