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]

[PATCH,i386] fma,fma4 and xop flags


Hello,

Bdver2 cpu supports both fma and fma4 instructions.
Previous to patch, option "-mno-xop" removes "-mfma4".
Similarly, option "-mno-fma4" removes "-mxop".

So, the patch conditionally disables "-mfma" or "-mfma4".
Enabling "-mxop" is done by also checking "-mfma".

Ok for trunk?

Regards
Ganesh

2012-08-08  Ganesh Gopalasubramanian  <Ganesh.Gopalasubramanian@amd.com>

    * common/config/i386/i386-common.c (ix86_handle_option): Reset 
    fma flag after checking fma4. Reset fma4 flag after checking fma. 
    Set xop flag after checking fma flags.

Index: gcc/common/config/i386/i386-common.c
===================================================================
--- gcc/common/config/i386/i386-common.c	(revision 189996)
+++ gcc/common/config/i386/i386-common.c	(working copy)
@@ -310,8 +310,16 @@
 	}
       else
 	{
-	  opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_FMA_UNSET;
-	  opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_FMA_UNSET;
+          if (opts->x_ix86_isa_flags & OPTION_MASK_ISA_FMA4)
+            {
+              opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_FMA ;
+              opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_FMA;
+            }
+          else
+            {
+	      opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_FMA_UNSET;
+	      opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_FMA_UNSET;
+            }
 	}
       return true;
 
@@ -359,16 +367,32 @@
 	}
       else
 	{
-	  opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_FMA4_UNSET;
-	  opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_FMA4_UNSET;
+          if (opts->x_ix86_isa_flags & OPTION_MASK_ISA_FMA)
+            {
+	      opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_FMA4 ;
+              opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_FMA4;
+            }
+          else
+            {
+	      opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_FMA4_UNSET;
+	      opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_FMA4_UNSET;
+	    }
 	}
       return true;
 
    case OPT_mxop:
       if (value)
 	{
-	  opts->x_ix86_isa_flags |= OPTION_MASK_ISA_XOP_SET;
-	  opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_XOP_SET;
+          if (opts->x_ix86_isa_flags & OPTION_MASK_ISA_FMA)
+            {
+              opts->x_ix86_isa_flags |= OPTION_MASK_ISA_XOP ;
+              opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_XOP;
+            }
+            else
+            {
+	      opts->x_ix86_isa_flags |= OPTION_MASK_ISA_XOP_SET;
+	      opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_XOP_SET;
+	    }
 	}
       else
 	{


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