From patchwork Fri Mar 22 23:15:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 230292 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id E1A912C00CF for ; Sat, 23 Mar 2013 10:16:36 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :date:to:subject:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=Fu9ml xxIG4nWZlw1F4hY46KlP3fHlBrWV7JhP7mecN2PTZzVPU6PjAMbCYHIuGC3hfbVw N4XPTtUN9hauDvtpJiL5kbzQGGvnyNjjlJLD83YqD27ujrsZB6qSv6Z4I7eO3lmw kSDg/zXgt0/LuqtJeLuCmfek21yz3sUk3nNl9w= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :date:to:subject:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=GlxsUIyz1hX aiZNRgtRbzAT3ROo=; b=RgDfWHDaMTogPCQPJ0mlP+bnnETXhnATewjUMcnUzxP nUBYB6GS99UPSxepiKsobeplhHY86L4TOjC2KQqzmsLA0NRpWq1Otd4+dXH0rPVP xIcYmzA8nrZkLKYxIWoZEbO52ouDlFLQFfN42ulw22lqmlPbTCEV8G+FMOp68fUg = Received: (qmail 13686 invoked by alias); 22 Mar 2013 23:16:26 -0000 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 Received: (qmail 13669 invoked by uid 89); 22 Mar 2013 23:16:18 -0000 X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from multi.imgtec.com (HELO multi.imgtec.com) (194.200.65.239) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 22 Mar 2013 23:16:15 +0000 From: "Steve Ellcey " Date: Fri, 22 Mar 2013 16:15:43 -0700 To: Subject: [patch, mips] Patch to control the use of integer madd/msub instructions User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Message-ID: <200323ec-7686-44f6-a5de-edc726909141@BAMAIL02.ba.imgtec.org> X-SEF-Processed: 7_3_0_01181__2013_03_22_23_16_13 While testing GCC on a 74k MIPS chip I noticed that by default the -mtune=74k* flags cause GCC to not use the integer madd/msub instructions. According to the checkin comments these were found to cause a performance hit over using individual mult and add/sub instructions. I think there are some programs though where using madd/msub would be a win on the 74k and I would like to have a flag to allow users to override the default behaviour (either turning it on for 74k or turning it off for other achitectures). This patch allows -mimadd or -mno-imadd to override the default behaviour but does not change that default behaviour. OK for checkin? Steve Ellcey sellcey@imgtec.com 2013-03-22 Steve Ellcey * config/mips/mips.md (mimadd): New flag for integer madd/msub. * config/mips/mips.h (GENERATE_MADD_MSUB): Check -mimadd flag. diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 0acce14..62a7701 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -875,7 +875,9 @@ struct mips_cpu_info { && !TARGET_MIPS16) /* Integer multiply-accumulate instructions should be generated. */ -#define GENERATE_MADD_MSUB (ISA_HAS_MADD_MSUB && !TUNE_74K) +#define GENERATE_MADD_MSUB (ISA_HAS_MADD_MSUB \ + && (target_flags_explicit & MASK_IMADD \ + ? TARGET_IMADD : !TUNE_74K)) /* ISA has floating-point madd and msub instructions 'd = a * b [+-] c'. */ #define ISA_HAS_FP_MADD4_MSUB4 ISA_HAS_FP4 diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt index d8ef2e7..6b3024b 100644 --- a/gcc/config/mips/mips.opt +++ b/gcc/config/mips/mips.opt @@ -58,6 +58,10 @@ mmad Target Report Var(TARGET_MAD) Use PMC-style 'mad' instructions +mimadd +Target Report Mask(IMADD) +Use integer madd/msub instructions + march= Target RejectNegative Joined Var(mips_arch_option) ToLower Enum(mips_arch_opt_value) -march=ISA Generate code for the given ISA