From patchwork Thu Aug 22 19:20:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 1151768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-507546-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Lx1BMOD6"; 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 46DvXD4jDwz9sMr for ; Fri, 23 Aug 2019 05:21:16 +1000 (AEST) 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:in-reply-to:references :in-reply-to:references; q=dns; s=default; b=b6UE4+ddRo05DzTl1oz UbXuu8dcC75EkIQNtbWXgcSX6yHC8Rv3DDEk4PUT7OiUVaD2BzlUPyUYR6UbiyN4 1TPKkSCxHcR3LWqzLwWesSXTqVrmk5XTtjgVJmJUMo8elg8W3argVPnwmZdxAy0y IRoy0Fsqr60zClLcCKOU+ovI= 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:in-reply-to:references :in-reply-to:references; s=default; bh=8O26TgGGOrDYU8eLswwfHhcTD yg=; b=Lx1BMOD6snfP/rfJY5pjH3RHHKed9fNpgFUoPTljY8V1IpoQC9gmT+iXi oQ2mRW4cLBM9EeWK4bKC0iJxPHB4wHUDszf16D+AvT8oIA1yZ4GIHmqASRbjEoSc uEnpbGoMUSjOgcieIRoHzSf9r7qxwxRFkQp71tmWxnJVxr9igY= Received: (qmail 78536 invoked by alias); 22 Aug 2019 19:21:08 -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 78458 invoked by uid 89); 22 Aug 2019 19:21:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Aug 2019 19:21:06 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 0DD4F1240902; Thu, 22 Aug 2019 19:21:04 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com, Segher Boessenkool Subject: [PATCH 2/2] rs6000: Use unspec_volatile for darn (PR91481) Date: Thu, 22 Aug 2019 19:20:48 +0000 Message-Id: <9f40f4acef1c0bf44707e9718d69e9fcd5c2adfc.1566482473.git.segher@kernel.crashing.org> In-Reply-To: <09c26a8006ac01916a17a5b6e7b50acf6497d5c4.1566482473.git.segher@kernel.crashing.org> References: <09c26a8006ac01916a17a5b6e7b50acf6497d5c4.1566482473.git.segher@kernel.crashing.org> In-Reply-To: <09c26a8006ac01916a17a5b6e7b50acf6497d5c4.1566482473.git.segher@kernel.crashing.org> References: <09c26a8006ac01916a17a5b6e7b50acf6497d5c4.1566482473.git.segher@kernel.crashing.org> X-IsSubscribed: yes Every call to darn should deliver a *new* random number; such calls shouldnot be CSEd together. So they should be unspec_volatile, not plain unspec. Tested on powerpc64-linux {-m32,-m64}. (New testcase coming soon). Committing to trunk, and will backport to 9, 8, 7 as well. Segher 2019-08-22 Segher Boessenkool PR target/91481 * config/rs6000/rs6000.md (unspec): Delete UNSPEC_DARN, UNSPEC_DARN_32, and UNSPEC_DARN_RAW. (unspecv): New enumerator values UNSPECV_DARN, UNSPECV_DARN_32, and UNSPECV_DARN_RAW. (darn_32): Use an unspec_volatile, and UNSPECV_DARN_32. (darn_raw): Use an unspec_volatile, and UNSPECV_DARN_RAW. (darn): Use an unspec_volatile, and UNSPECV_DARN. --- gcc/config/rs6000/rs6000.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 68cdf68..b0aea23 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -134,9 +134,6 @@ (define_c_enum "unspec" UNSPEC_LSQ UNSPEC_FUSION_GPR UNSPEC_STACK_CHECK - UNSPEC_DARN - UNSPEC_DARN_32 - UNSPEC_DARN_RAW UNSPEC_CMPRB UNSPEC_CMPRB2 UNSPEC_CMPEQB @@ -168,6 +165,9 @@ (define_c_enum "unspecv" UNSPECV_EH_RR ; eh_reg_restore UNSPECV_ISYNC ; isync instruction UNSPECV_MFTB ; move from time base + UNSPECV_DARN ; darn 1 (deliver a random number) + UNSPECV_DARN_32 ; darn 2 + UNSPECV_DARN_RAW ; darn 0 UNSPECV_NLGR ; non-local goto receiver UNSPECV_MFFS ; Move from FPSCR UNSPECV_MFFSL ; Move from FPSCR light instruction version @@ -14387,21 +14387,21 @@ (define_insn "*cmp_hw" (define_insn "darn_32" [(set (match_operand:SI 0 "register_operand" "=r") - (unspec:SI [(const_int 0)] UNSPEC_DARN_32))] + (unspec_volatile:SI [(const_int 0)] UNSPECV_DARN_32))] "TARGET_P9_MISC" "darn %0,0" [(set_attr "type" "integer")]) (define_insn "darn_raw" [(set (match_operand:DI 0 "register_operand" "=r") - (unspec:DI [(const_int 0)] UNSPEC_DARN_RAW))] + (unspec_volatile:DI [(const_int 0)] UNSPECV_DARN_RAW))] "TARGET_P9_MISC && TARGET_64BIT" "darn %0,2" [(set_attr "type" "integer")]) (define_insn "darn" [(set (match_operand:DI 0 "register_operand" "=r") - (unspec:DI [(const_int 0)] UNSPEC_DARN))] + (unspec_volatile:DI [(const_int 0)] UNSPECV_DARN))] "TARGET_P9_MISC && TARGET_64BIT" "darn %0,1" [(set_attr "type" "integer")])