From patchwork Tue Mar 1 20:59:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fang, Changpeng" X-Patchwork-Id: 84987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8AA3CB6F0B for ; Wed, 2 Mar 2011 07:59:16 +1100 (EST) Received: (qmail 17283 invoked by alias); 1 Mar 2011 20:59:15 -0000 Received: (qmail 17275 invoked by uid 22791); 1 Mar 2011 20:59:14 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, TW_AV, TW_BD X-Spam-Check-By: sourceware.org Received: from ch1outboundpool.messaging.microsoft.com (HELO ch1outboundpool.messaging.microsoft.com) (216.32.181.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Mar 2011 20:59:10 +0000 Received: from mail120-ch1-R.bigfish.com (216.32.181.171) by CH1EHSOBE003.bigfish.com (10.43.70.53) with Microsoft SMTP Server id 14.1.225.8; Tue, 1 Mar 2011 20:59:08 +0000 Received: from mail120-ch1 (localhost.localdomain [127.0.0.1]) by mail120-ch1-R.bigfish.com (Postfix) with ESMTP id 4DD827F80D1; Tue, 1 Mar 2011 20:59:08 +0000 (UTC) X-SpamScore: -3 X-BigFish: VPS-3(zz4015Lzz1202hzzz32i668h34h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI Received: from mail120-ch1 (localhost.localdomain [127.0.0.1]) by mail120-ch1 (MessageSwitch) id 1299013147376741_22867; Tue, 1 Mar 2011 20:59:07 +0000 (UTC) Received: from CH1EHSMHS022.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.249]) by mail120-ch1.bigfish.com (Postfix) with ESMTP id 54DECFA8050; Tue, 1 Mar 2011 20:59:07 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by CH1EHSMHS022.bigfish.com (10.43.70.22) with Microsoft SMTP Server id 14.1.225.8; Tue, 1 Mar 2011 20:59:05 +0000 X-M-MSG: Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2252D1028537; Tue, 1 Mar 2011 14:59:00 -0600 (CST) Received: from sausexhtp02.amd.com (163.181.3.152) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.106.1; Tue, 1 Mar 2011 15:05:13 -0600 Received: from SAUSEXMBP01.amd.com ([163.181.3.198]) by sausexhtp02.amd.com ([163.181.3.152]) with mapi; Tue, 1 Mar 2011 14:59:04 -0600 From: "Fang, Changpeng" To: "H.J. Lu" , Richard Guenther , "gcc-patches@gcc.gnu.org" CC: "hubicka@ucw.cz" , "rth@redhat.com" Date: Tue, 1 Mar 2011 14:59:03 -0600 Subject: [PATCH, i386] Introduce a flag to generate only 128-bit avx instructions Message-ID: MIME-Version: 1.0 X-OriginatorOrg: amd.com Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, Attached is the patch that introduces a new flag, -mavx-m128-only, for gcc to have the ability to generate only 128-bit avx instructions. This flag (default is off) helps tuning avx performance as well as benchmarking. The patch passed bootstrapping on x86_64-unknown-linux-gnu with "-O3 -g -march=bdver1 -mavx-m128-only" and the necessary correctness and performance tests. Is it OK to commit to 4.6 trunk? Thanks, Changpeng From d84b2a81e0b1d5c2d01f75f1398440d21da26e29 Mon Sep 17 00:00:00 2001 From: Changpeng Fang Date: Tue, 1 Mar 2011 12:50:46 -0800 Subject: [PATCH] Introduce flag -mavx-m128-only to generate only 128-bit avx instructions. * config/i386/i386.opt (mavx-m128-only): New flag. * config/i386/i386.c (ix86_preferred_simd_mode): Prefer 128-bit mode if the flag -mavx-m128-only is turned on. --- gcc/config/i386/i386.c | 4 ++-- gcc/config/i386/i386.opt | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index aa59ada..f700b14 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_avx_m128_only ? V4SFmode : V8SFmode) : V4SFmode; case DFmode: - return TARGET_AVX ? V4DFmode : V2DFmode; + return TARGET_AVX ? (flag_avx_m128_only ? V2DFmode : V4DFmode) : V2DFmode; case DImode: return V2DImode; case SImode: diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt index 85362d7..8968b25 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. +mavx-m128-only +Target Report Var(flag_avx_m128_only) Init(0) +Generate only 128-bit AVX instructions. + ;; ISA support m32 -- 1.6.3.3