From patchwork Wed May 27 14:20:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Suchanek X-Patchwork-Id: 477164 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7A35714016A for ; Thu, 28 May 2015 00:21:25 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=wX3dzjHE; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=NIv cWwnYoFExfE5+7r1/EEzW+nN+7UWIqXACN4uUDLa3mwTwYvAAad9V4VkET1OF9D2 NpVL8sskjRQ0bVxFE4aoxnH3QGkNTIjBPhCB/5+HNp+68hr21YP4mb20ItF4L7cJ yhH00B8WeZxHk3aCTDFSIMtuywt/PoLKCI/IaL9Y= 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 :to:cc:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=default; bh=uvGyjGFU4 msviPtevI10ma2Zo3o=; b=wX3dzjHE/cq8kpunJr0AJAK4nEbw+H2wwBNTavBRS X9skMuOU9UUu8WHnbLDFngRhOLzv77yGnZwapbAMTnPtZUvd8MLzRqmdRHjZPiWm C1qPQ+dYWSeVEm6cvjiFZ7Gzs5NYroEGDxYME7lZvOJlANNW2vvl44Ff4vXn8f0j wI= Received: (qmail 2192 invoked by alias); 27 May 2015 14:21:17 -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 118040 invoked by uid 89); 27 May 2015 14:20:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 May 2015 14:20:45 +0000 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 9F0E8124DFDA8; Wed, 27 May 2015 15:20:40 +0100 (IST) Received: from hhmail02.hh.imgtec.org (10.100.10.20) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 27 May 2015 15:20:42 +0100 Received: from hhmail02.hh.imgtec.org ([::1]) by hhmail02.hh.imgtec.org ([::1]) with mapi id 14.03.0224.002; Wed, 27 May 2015 15:20:42 +0100 From: Robert Suchanek To: Matthew Fortune , "Catherine_Moore@mentor.com" CC: "gcc-patches@gcc.gnu.org" Subject: [Patch MIPS] Enable TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS hook Date: Wed, 27 May 2015 14:20:41 +0000 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi, The patch enables the hook for MIPS as a result of the discussion: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65862 Tested on mips-mti-linux-gnu and mips-img-linux-gnu. Ok to apply? Regards, Robert gcc/ChangeLog: * config/mips/mips.c (mips_ira_change_pseudo_allocno_class): New function. (TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS): Define macro. gcc/testsuite/ChangeLog: * gcc.target/mips/pr65862-1.c: New test. * gcc.target/mips/pr65862-2.c: Likewise. --- gcc/config/mips/mips.c | 13 +++++++++++++ gcc/testsuite/gcc.target/mips/pr65862-1.c | 16 ++++++++++++++++ gcc/testsuite/gcc.target/mips/pr65862-2.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 gcc/testsuite/gcc.target/mips/pr65862-1.c create mode 100644 gcc/testsuite/gcc.target/mips/pr65862-2.c diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index c3755f5..3c8ac30 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -19415,6 +19415,17 @@ mips_lra_p (void) { return mips_lra_flag; } + +/* Implement TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS. */ + +static reg_class_t +mips_ira_change_pseudo_allocno_class (int regno, reg_class_t allocno_class) +{ + if (FLOAT_MODE_P (PSEUDO_REGNO_MODE (regno)) || allocno_class != ALL_REGS) + return allocno_class; + return GR_REGS; +} + /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -19671,6 +19682,8 @@ mips_lra_p (void) #define TARGET_SPILL_CLASS mips_spill_class #undef TARGET_LRA_P #define TARGET_LRA_P mips_lra_p +#undef TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS +#define TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS mips_ira_change_pseudo_allocno_class struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/testsuite/gcc.target/mips/pr65862-1.c b/gcc/testsuite/gcc.target/mips/pr65862-1.c new file mode 100644 index 0000000..0c00092 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/pr65862-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */ +/* { dg-final { scan-assembler-not "\\\$f\[0-9\]+" } } */ +int a, c; +int *b, *d; +void +fn1(int p1, int *p2(void *, void *), void *p3(void *, void *, int)) { + int n = c; + for (;;) { + a = 1; + for (; a < n;) { + *d = p1 && p2(0, (int *) ((long)p1 + 1)); + p3(0, b + p1, 0); + } + } +} diff --git a/gcc/testsuite/gcc.target/mips/pr65862-2.c b/gcc/testsuite/gcc.target/mips/pr65862-2.c new file mode 100644 index 0000000..c6a2641 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/pr65862-2.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */ +/* { dg-final { scan-assembler-not "\\\$f\[0-9\]+" } } */ +int a, b, d, e, j, k, n, o; +unsigned c, h, i, l, m, p; +int *f; +int *g; +int fn1(int p1) { return p1 - a; } + +int fn2() { + b = b + 1 - a; + e = 1 + o + 1518500249; + d = d + n; + c = (int)c + g[0]; + b = b + m + 1; + d = d + p + 1518500249; + d = d + k - 1; + c = fn1(c + j + 1518500249); + e = fn1(e + i + 1); + d = d + h + 1859775393 - a; + c = fn1(c + (d ^ 1 ^ b) + g[1] + 1); + b = fn1(b + m + 3); + d = fn1(d + l + 1); + b = b + (c ^ 1) + p + 1; + e = fn1(e + (b ^ c ^ d) + n + 1); + d = o; + b = 0; + e = e + k + 1859775393; + f[0] = e; + return a; +}