From patchwork Tue Oct 25 14:59:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 686490 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 3t3GXQ4qrdz9t2n for ; Wed, 26 Oct 2016 01:59:49 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=P3CHQMkn; 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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=DH8xJRRJF3eBHiRW3OAI/ay5Egvbgz5UTwIYBZ3l7QJpC7xx0e RmpM7ITgidu00aQgeM9N/Y+2oTbzjp0Qt1ts4sk/nvTYEC+QcBlxFS9P+2vWFDoK UzEJ21iWPwo0ZVkq+03Dcaqp7b+N2F09rRZ3aFHVsaJTM4DnWkjDpCI3Y= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=QBA/cin5076QR3JIOgB4URiVi7E=; b=P3CHQMknxU6eo3UHbc0Y nx02A3MV1lgsK/g8AoScG/l5sz2k881v2XHPQfciOHr3gBFuDf9+8ULV99ERPmMy 2/1uozN1PYeuirr28xeV98MaF8jlhHjnysTaRQqbZjSU8Bsm6p0ppaiby6fVFI8m ++9MdNpR7FBFv9zEDRnWfjs= Received: (qmail 44219 invoked by alias); 25 Oct 2016 14:59:21 -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 44142 invoked by uid 89); 25 Oct 2016 14:59:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1933 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Oct 2016 14:59:16 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 751E8C04D2B4 for ; Tue, 25 Oct 2016 14:59:14 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-87.phx2.redhat.com [10.3.116.87]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9PExDT3030156 for ; Tue, 25 Oct 2016 10:59:14 -0400 To: gcc-patches From: Jeff Law Subject: [RFA] Patch to allow SPU port to build with current trunk Message-ID: Date: Tue, 25 Oct 2016 08:59:13 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 X-IsSubscribed: yes The fallthru warnings triggered a couple times in the SPU port. I'm not at all familiar with the chip or the port, but based on the little reading I've done and experience with GCC, I believe this patch is correct. First, there's a missing fallthru comment in spu_sched_reorder for TYPE_LOAD/TYPE_STORE cases. If I'm reading the SPU docs properly a load/store insn is handled by pipe_1 and we're also trying to model some aspects of the load-store unit. So we should be setting pipe_ls and pipe_1: case TYPE_LOAD: case TYPE_STORE: pipe_ls = i; case TYPE_LNOP: case TYPE_SHUF: case TYPE_BR: case TYPE_MULTI1: case TYPE_HBR: pipe_1 = i; break; This looks like intentional fallthru and should just have an appropriate comment to silence the warning. spu_legitimate_address looks far more interesting and I think it's buggy as written: case SUBREG: x = XEXP (x, 0); if (REG_P (x)) return 0; case REG: return INT_REG_OK_FOR_BASE_P (x, reg_ok_strict); I think the test is inverted. We want to consider (subreg (reg)) a valid memory address and reject all other (subreg (...)) expressions. But this code does the opposite. OK for the trunk? Jeff * config/spu/spu.c (spu_sched_reorder): Add missing fallthru comment. (spu_legitimate_address_p): Fix logic error and add missing fallthru comment. diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 5b59b72..820924e 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -2894,6 +2894,7 @@ spu_sched_reorder (FILE *file ATTRIBUTE_UNUSED, int verbose ATTRIBUTE_UNUSED, case TYPE_LOAD: case TYPE_STORE: pipe_ls = i; + /* FALLTHRU */ case TYPE_LNOP: case TYPE_SHUF: case TYPE_BR: @@ -3532,8 +3533,9 @@ spu_legitimate_address_p (machine_mode mode, case SUBREG: x = XEXP (x, 0); - if (REG_P (x)) + if (!REG_P (x)) return 0; + /* FALLTHRU */ case REG: return INT_REG_OK_FOR_BASE_P (x, reg_ok_strict);