From patchwork Tue Oct 16 08:54:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 148921 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp4814086lji; Tue, 16 Oct 2018 01:56:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV62cp008nZ3bi4Zlj/ISMtlqEGvajDWltbYsBaxJYxMN/Of+WUrZi3vAJQtAz6eVwM4cPTpA X-Received: by 2002:a63:8e43:: with SMTP id k64-v6mr18764419pge.75.1539680197222; Tue, 16 Oct 2018 01:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539680197; cv=none; d=google.com; s=arc-20160816; b=ACA4ybfQ3HtWeNNtNSv3yGW4C/KN/3UMWsSGtq+3rBz/CT4CGYB0WgdJIzRKOEUSho ZgGbBJQEn9wtNONGAXn5ZzuK2SMq3PJ+rJZGZRpNcAFDSMdc0ffeRN2Iyo9peG5VBmea sCyAnodq+vW7N9aZ58HAJgzdFLJcdbg8PWHFu2vLs0EQ0GCL1nRj4SXLk5z04ZWsYw2f s0pQFS791JK212lxxN0JKOWQFRk3IP+8kbPzW8OTUUnLJ+bGTwVrw6R2lB7TGORskQbc 0me75vGu6WWL4S7EsaQYWSV4VtlrnOtLI9nh6XQq9vuofHyjL6o4uvy7e91qB4BEYpvJ mnkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:mime-version:user-agent:from:date:message-id :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=qXWegpMKQqSLhIe3DcueYnfZMt6VI++bBisY4aeupiU=; b=EI2YNWUhHtPiE5WA2ZbFj752/5cGAvvXTD51HQB/FeyN88ejJvE7fIkdUbzw9y9g8P OzxkCOreWyiNdGWhStzfw6rUcFTpYWov7ri/BcPXqK+yJk35yaJDqLVbohKKOayqs3go B6u1duIJIjQPuRcamjubsLsfg7Yju4vBvbcbQnopNH+OYlaIg2G5wodBnWoJgfT7fhBO GCkvmB6mC2CZRLJOUWWF7530lNJopjxONB4Wkw2KSw1LaKe3WwYFhEZ3dlwYUyJ1Jbg2 nWTUD3NMKHgogvQG3ooojkEuC4Nz5mPqAgcW4D8Iho5ASyoSwKapX1j8RfwsMzkTQB+a PfsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=APyw2niJ; dkim=fail header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=paBzxGi6; spf=pass (google.com: domain of gcc-patches-return-487618-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-487618-patch=linaro.org@gcc.gnu.org" Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q15-v6si12379147pgg.477.2018.10.16.01.56.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Oct 2018 01:56:37 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-487618-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=APyw2niJ; dkim=fail header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=paBzxGi6; spf=pass (google.com: domain of gcc-patches-return-487618-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-487618-patch=linaro.org@gcc.gnu.org" DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=ciQeI/12i07xDAYHivkd6ETh7igBfcH0dE9fNo9qrze Afm1VBUsFpOhrvWZSESEgqP3fmpflhIQjNnrbmOxhDYnInsqsNz3lVS+lOP4JlkM 9sHOuVMfUpCJQS3CkajpLvYVThVsOjuAJZj2U4ElbLcd8yDsjpPmAjrjca4XFPJE = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=z5M5IZ0Z6BoCO942ikfEAXNQ1YM=; b=APyw2niJd64MXkvSB I6OMZ7xaTduDS+GtJtFnrq/E+A+k3971TqYdtM6m9/kEZHlqoiowGs60SSlpQa0x 7u1cckOncFUC2i0BfO5nlbpwKtLhdVfeywt9JSlYdxd4tVtFKOt3+n0x5n0m2mXA rruqhSl/NsUacSA7sVIBlBPt/g= Received: (qmail 31936 invoked by alias); 16 Oct 2018 08:56:16 -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 31405 invoked by uid 89); 16 Oct 2018 08:55:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=tracker, speculation, H*u:31.0, H*UA:31.0 X-HELO: EUR02-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr00074.outbound.protection.outlook.com (HELO EUR02-AM5-obe.outbound.protection.outlook.com) (40.107.0.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Oct 2018 08:55:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qXWegpMKQqSLhIe3DcueYnfZMt6VI++bBisY4aeupiU=; b=paBzxGi6fXNFylRLvueNsxIsTp7t09a5KNavOE3SzmbFU1KYbAig+gEXo8ffV7IgIwMKYlkJlYAiLGa8sM3m+xrcuPfJ74lX8aD/jIMqknUWBzwtr2bIFb+rLS0K2A2M2cN1LZdBdDMadbbqKR7NzNxbwBihhdJ6NWhWzsKB5nE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kyrylo.Tkachov@arm.com; Received: from [10.2.207.77] (217.140.106.53) by DB7PR08MB3002.eurprd08.prod.outlook.com (2603:10a6:5:1c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.26; Tue, 16 Oct 2018 08:54:47 +0000 Message-ID: <5BC5A755.1010806@arm.com> Date: Tue, 16 Oct 2018 09:54:45 +0100 From: Kyrylo Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Marcus Shawcroft , "Richard Earnshaw (lists)" , James Greenhalgh , nd Subject: [PATCH][AArch64] Use @ pattern to eliminate switch statement in one more place Return-Path: kyrylo.tkachov@arm.com Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-IsSubscribed: yes Hi all, We can use the new '@' modifier to MD patterns to generate mode-parametrised gen_ functions for the despeculate_copy patterns and therefore remove the switch on modes in aarch64.c that is used to pick the right generator. This simplifies the code. Bootstrapped and tested on aarch64-none-linux-gnu. Ok for trunk? Thanks, Kyrill 2018-10-16 Kyrylo Tkachov * config/aarch64/aarch64.md (despeculate_copy): Rename to... (@despeculate_copy): ... This. * config/aarch64/aarch64.c (aarch64_speculation_safe_value): Remove switch statement. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 34d08a075221fd4c098e9b5e8fabd8fe3948d285..03041c5af99e52de8f5b4d8342e93ef2b90985bc 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -17968,26 +17968,7 @@ aarch64_speculation_safe_value (machine_mode mode, if (!aarch64_reg_or_zero (failval, mode)) failval = copy_to_mode_reg (mode, failval); - switch (mode) - { - case E_QImode: - emit_insn (gen_despeculate_copyqi (result, val, failval)); - break; - case E_HImode: - emit_insn (gen_despeculate_copyhi (result, val, failval)); - break; - case E_SImode: - emit_insn (gen_despeculate_copysi (result, val, failval)); - break; - case E_DImode: - emit_insn (gen_despeculate_copydi (result, val, failval)); - break; - case E_TImode: - emit_insn (gen_despeculate_copyti (result, val, failval)); - break; - default: - gcc_unreachable (); - } + emit_insn (gen_despeculate_copy (mode, result, val, failval)); return result; } diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 4170d3fbb00c733a1411e726a67af17052800307..32d6f138232c617213f0d3488db49cb3546eb0a9 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -6743,7 +6743,7 @@ (define_insn "speculation_barrier" ;; Support for __builtin_speculation_safe_value when we have speculation ;; tracking enabled. Use the speculation tracker to decide whether to ;; copy operand 1 to the target, or to copy the fail value (operand 2). -(define_expand "despeculate_copy" +(define_expand "@despeculate_copy" [(set (match_operand:ALLI_TI 0 "register_operand" "=r") (unspec_volatile:ALLI_TI [(match_operand:ALLI_TI 1 "register_operand" "r")