From patchwork Mon Nov 25 11:14:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1200349 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-514511-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="EpMvKosx"; dkim-atps=neutral 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 47M4Dz5vDXz9sNx for ; Mon, 25 Nov 2019 22:14:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:references:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=pPI8Il0vkk/nzuA/V ZVw/ri7/S+sxbzHsaQJbfclBC08fxAjGE6W+Mu0iYM7kxLUhwxWx2sL+qwY9/eTe K8EC7dJYj/lbGE/TtfblJOaPrLqWz7dV8g/Ed5CGEwyvP9rH08rumZ2FpvMNhHDI 0crrE5QlZzBsOouO0i+EojEPUQ= 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 :subject:from:to:references:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=qLeu5HZ7qCagfYuqfq7Q6x4 KoqA=; b=EpMvKosxnQVWdzWXDAIkOPy+WHmYhO13jLuHbTzVRFP1j0XD864cO0d 7+LZKZ7dZ6N6GT3PkCdbJH2t0+ESwTghg0Fzua7TYlSEidr3xBYF6yYaA1GnyyDk rQmvFctcZiV/vy5yM0/ub5fP3jlqhYyfPlQ1SNyIQ42Du74R4808= Received: (qmail 123817 invoked by alias); 25 Nov 2019 11:14:34 -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 123805 invoked by uid 89); 25 Nov 2019 11:14:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-13.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_PASS autolearn=ham version=3.3.1 spammy=silence, sk:Wunused, sk:wunused X-HELO: esa4.mentor.iphmx.com Received: from esa4.mentor.iphmx.com (HELO esa4.mentor.iphmx.com) (68.232.137.252) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 25 Nov 2019 11:14:32 +0000 IronPort-SDR: UOK7Edr6yWj4Y8UwvxC4/RzqhDYNRt/SuXJ3jx4Qv5fOTWvIUJpvDo0ypHvpponvrwG1CJOogj k4S412+7H2v8sz2C23VER0HPhPOQxnRMUBqarWxPml53KFWaYu42yHPeHn4ZJPE0LnlaYn5Pdz 3qi/zPnEDNk09Bv3KyhEWoIY6R3bLH4Ldx7bdVLBgmVGupRNAPOr8gPbIqTMP0lNzxKcc01SZC BPmsaRkQqg0uQ1+Vir40gMXos5iNXI7s3qNvhrg+xBRBBeOrWaEEFfIanx3vOgQ6C2qm827svM dns= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 25 Nov 2019 03:14:31 -0800 IronPort-SDR: 0jKVa566wJ9QjCVqz712kMRKbf7eqjYnWlHVeyYtPwDGYSChtDSwTL0HH9ZHpYaTdkObrIoY+b GY+fp2GwCTvwyUbTdnrliuMGgssLSKKhzXa6lfe/1yadAqZOXWydymTRpFDBVUToFwnb5rj4eI PwG6o8zXzv2Wv/8IDxH3U+B7tEcLV7zsaCbNOy5UHZdvj/vkGMwH5MbQeazVasvfIipt/ZsuJA NJwd0IcAU/PXoChPbCFm7g9LkP7Qaz4AxcqZQ+ML7rFO73d2WwuvNFq91xnjxD/IoXeW5f90vW Bi8= Subject: [Patch][amdgcn] Silence warnings + add gcc_unreachable() (was: Re: [committed, amdgcn] Use GFX9 granulated sgprs count correctly) From: Tobias Burnus To: Andrew Stubbs , "gcc-patches@gcc.gnu.org" References: <73abebf8-9424-8c2a-e37c-7137b0fa6448@codesourcery.com> Message-ID: Date: Mon, 25 Nov 2019 12:14:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <73abebf8-9424-8c2a-e37c-7137b0fa6448@codesourcery.com> X-IsSubscribed: yes This patch adds "gcc_unreachable ();" as suggested by me (cf. below). It also silences the -Wunused-variable + 'no return statement' warnings. OK for the trunk? Tobias PS: The warning fixes were part of my OG9 silence-warnings patch at https://gcc.gnu.org/ml/gcc-patches/2019-09/msg01056.html , committed to OG9 as 500483e6ced44e2e0fea6a37e4f8c267ebaf826a On 11/22/19 3:56 PM, Tobias Burnus wrote: > On 11/22/19 3:47 PM, Andrew Stubbs wrote: >> --- a/gcc/config/gcn/gcn.c >> +++ b/gcc/config/gcn/gcn.c >> @@ -4922,6 +4922,14 @@ gcn_hsa_declare_function_name (FILE *file, >> const char *name, tree) >> +  int granulated_sgprs; >> +  if (TARGET_GCN3) >> +    granulated_sgprs = (sgpr + extra_regs + 7) / 8 - 1; >> +  else if (TARGET_GCN5) >> +    granulated_sgprs = 2 * ((sgpr + extra_regs + 15) / 16 - 1); > > Would it make sense to add here: > > else >   gcc_unreachable (); > > (TARGET_GCN5_PLUS would also work, but gcc_unreachable is probably > better.) 2019-11-25 Tobias Burnus * config/gcn/gcn.c (gcn_expand_scalar_to_vector_address, gcn_md_reorg): Remove unused variables. (gcn_emutls_var_init): Add missing (but unreachable) return to silence warning. (gcn_hsa_declare_function_name): Add gcc_unreachable to ensure target != TARGET_GCN3 or TARGET_GCN3 will fail instead of use an uninitialized variable. Index: gcc/config/gcn/gcn.c =================================================================== --- gcc/config/gcn/gcn.c (revision 278670) +++ gcc/config/gcn/gcn.c (working copy) @@ -1783,7 +1783,6 @@ gcn_expand_scalar_to_vector_address (machine_mode /* tmp[:] += zext (mem_base) */ if (exec) { - rtx undef_di = gcn_gen_undef (DImode); emit_insn (gen_addv64si3_vcc_dup_exec (tmplo, mem_base_lo, tmplo, vcc, undef_v64si, exec)); emit_insn (gen_addcv64si3_exec (tmphi, tmphi, const0_rtx, @@ -3213,6 +3212,7 @@ tree gcn_emutls_var_init (tree, tree decl, tree) { sorry_at (DECL_SOURCE_LOCATION (decl), "TLS is not implemented for GCN."); + return NULL_TREE; } /* }}} */ @@ -4340,8 +4340,6 @@ gcn_md_reorg (void) { basic_block bb; rtx exec_reg = gen_rtx_REG (DImode, EXEC_REG); - rtx exec_lo_reg = gen_rtx_REG (SImode, EXEC_LO_REG); - rtx exec_hi_reg = gen_rtx_REG (SImode, EXEC_HI_REG); regset_head live; INIT_REG_SET (&live); @@ -4937,6 +4935,8 @@ gcn_hsa_declare_function_name (FILE *file, const c granulated_sgprs = (sgpr + extra_regs + 7) / 8 - 1; else if (TARGET_GCN5) granulated_sgprs = 2 * ((sgpr + extra_regs + 15) / 16 - 1); + else + gcc_unreachable (); fputs ("\t.align\t256\n", file); fputs ("\t.type\t", file);