From d9c642462049486d1dbf560686723313193baf43 Mon Sep 17 00:00:00 2001 From: Changpeng Fang Date: Fri, 4 Mar 2011 17:56:39 +0000 Subject: [PATCH] Introduce flag -mprefer-avx128 for the auto-vectorizer to generate only 128-bit avx insns. * config/i386/i386.opt (mprefer-avx128): New flag. * config/i386/i386.c (ix86_preferred_simd_mode): Prefer 128-bit mode when the flag -mprefer-avx128 is on. From-SVN: r170681 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.c | 4 ++-- gcc/config/i386/i386.opt | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 838b8cedf4c..ec81d68394d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-03-04 Changpeng Fang + + * config/i386/i386.opt (mprefer-avx128): New flag. + * config/i386/i386.c (ix86_preferred_simd_mode): Prefer 128-bit mode + when the flag -mprefer-avx128 is on. + 2011-03-04 Richard Sandiford * dwarf2out.c (compare_loc_operands): Fix address handling. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index aa59adacd5e..82d999beb92 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -34747,9 +34747,9 @@ ix86_preferred_simd_mode (enum machine_mode mode) switch (mode) { case SFmode: - return TARGET_AVX ? V8SFmode : V4SFmode; + return (TARGET_AVX && !flag_prefer_avx128) ? V8SFmode : V4SFmode; case DFmode: - return TARGET_AVX ? V4DFmode : V2DFmode; + return (TARGET_AVX && !flag_prefer_avx128) ? V4DFmode : V2DFmode; case DImode: return V2DImode; case SImode: diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt index 85362d73105..0563bc1f925 100644 --- a/gcc/config/i386/i386.opt +++ b/gcc/config/i386/i386.opt @@ -266,6 +266,10 @@ Target RejectNegative Var(flag_dispatch_scheduler) Do dispatch scheduling if processor is bdver1 and Haifa scheduling is selected. +mprefer-avx128 +Target Report Var(flag_prefer_avx128) Init(0) +Use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer. + ;; ISA support m32 -- 2.30.2