This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH,i386] fma,fma4 and xop flags
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Ganesh dot Gopalasubramanian at amd dot com
- Cc: gcc-patches at gcc dot gnu dot org, ubizjak at gmail dot com
- Date: Wed, 8 Aug 2012 13:42:15 +0200
- Subject: Re: [PATCH,i386] fma,fma4 and xop flags
- References: <20120808113105.21153.11115.sendpatchset@adcelk01.amd.com>
On Wed, Aug 8, 2012 at 1:31 PM, <Ganesh.Gopalasubramanian@amd.com> wrote:
> Hello,
>
> Bdver2 cpu supports both fma and fma4 instructions.
> Previous to patch, option "-mno-xop" removes "-mfma4".
> Similarly, option "-mno-fma4" removes "-mxop".
Eh? Why's that? I think we should disentangle -mxop and -mfma4
instead. Otherwise, what does -mno-fma4 -mxop do?
(it should enable both xop and fma4!) what should -mfma4 -mno-xop do
(it should disable both xop and fma4!). All this is just confusing to
the user, even if in AMD documents XOP includes FMA4.
Richard.
> 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
> {
>