From patchwork Fri Aug 23 22:12:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 1152459 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-507650-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="SH8tK+ma"; 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 46FbHP1Tvmz9sDB for ; Sat, 24 Aug 2019 08:12:33 +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; q=dns; s=default; b=CwTRKuj54d2h 3PFMwm65YsukgjogwR4Hku/0UmffU2dMEIjJ8wCIDXI7cWu0XewUmp/cBikDuKTt peRbFQhCLOKSsjWGTDkbSZFQDMx79PeSVNUjf6J+VaumYqGIFSFYb48z/jryeEjj QfzwRhu96YmFcl6/G/Xt/X8hLJtlXgw= 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; s=default; bh=qbS0DNVYb3WsMKEL8Q btbkIEtnY=; b=SH8tK+mazvaXFUnFJiODtad1LwsNSnTQG2BncC1884UbTeSQnl 22FmWrRzTeQjvPxwt3bIcZ+b8pglWTY+DVwGFdosFhafhFuOqI3XairyeiCYtN7a eVnvaG+UYTpRCzdu8YbtT4htz9PXBwbiSSL32ldtsYRxhO1VgidWyNtAA= Received: (qmail 90844 invoked by alias); 23 Aug 2019 22:12:26 -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 90835 invoked by uid 89); 23 Aug 2019 22:12:26 -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=HX-Languages-Length:1430 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; Fri, 23 Aug 2019 22:12:24 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 19BE412404B9; Fri, 23 Aug 2019 22:12:22 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com, Segher Boessenkool Subject: [PATCH] rs6000: New darn testcase (PR91481) Date: Fri, 23 Aug 2019 22:12:21 +0000 Message-Id: X-IsSubscribed: yes We used to implement darn with unspecs, not unspec_volatiles, which means two darn instructions could be CSEd together. This testcase tests it by adding together four random numbers. If all is well that means we get four darn instructions, because such a small loop is unrolled fine at -O2 already. If things go bad, combine will combine it all to one darn and a shift left by two. Tested on powerpc64-linux {-m32,-m64,-m32/-mpowerpc64}. Committing to trunk. Segher 2019-08-22 Segher Boessenkool gcc/testsuite/ PR target/91481 * gcc.target/powerpc/darn-3.c: New testcase. --- gcc/testsuite/gcc.target/powerpc/darn-3.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/darn-3.c diff --git a/gcc/testsuite/gcc.target/powerpc/darn-3.c b/gcc/testsuite/gcc.target/powerpc/darn-3.c new file mode 100644 index 0000000..477901f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/darn-3.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-aix* } } */ +/* { dg-options "-O2 -mdejagnu-cpu=power9" } */ + +static int darn32(void) { return __builtin_darn_32(); } + +int four(void) +{ + int sum = 0; + int i; + for (i = 0; i < 4; i++) + sum += darn32(); + return sum; +} + +/* { dg-final { scan-assembler-times {(?n)\mdarn .*,0\M} 4 } } */