From patchwork Tue Apr 25 00:24:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 87223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3084519vqo; Mon, 24 Apr 2023 17:25:07 -0700 (PDT) X-Google-Smtp-Source: AKy350Y79TecY0sI7A7gGZQHx2EIopPftRRrzU2d+zMOC+Wn4L7yXu5AhEYUjX8voubJlu5rai9F X-Received: by 2002:a50:fc01:0:b0:504:7171:4542 with SMTP id i1-20020a50fc01000000b0050471714542mr12146565edr.0.1682382306965; Mon, 24 Apr 2023 17:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682382306; cv=none; d=google.com; s=arc-20160816; b=CIcRdshq3nHMXNgg26bdh4jAheMLmFIiyzfocMvxZtwJG7K6RgRuakp/6WbLQ2dIhy KPgNMqFRN2KEnB9zb5jef7Hs1dCPqOyuIpMB+WOA6BNjGqcv+ed5rvagC7c+xqoFNEa0 1sGqg7UAWe6MNp6hwP7lThcgot50Ae3TqI7sUdt8lhmgUtn71gYnpkbV1+rw6qSAZbjA z2RGvHuKg5y60mxi7M4+tldcGpFWpNJPb+FqZd5Ewhxh6rcU6s4y4p9nSSB/8bkayxt8 arxoqXBVOdzEoNAaKisMQcpe0pD4tJSrorCrjhOFDETMXwbonFR6iC0osHkH9XgTz03n B8sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=8VGBkwj1/+ZX+cGKH5M1vYx9UIa9bPxhVPnjJCPD7c0=; b=dNCW9Iy5WTY9u7KmqBFx9ppmyH+vtFsKzLmrtSC1VzthEKVLXVNuXY9M9DDMV+deCv GNR8X8pX8YYceNrqpQFAMKZwKOuGQ17jaaZLQdr8+DoAiSSIVCjK1cqVBkdVMSewE+yB QOdvFzG2BA7gRXKp8ENaAOWkKloFeyvCcXBjzgH96pxBwTMWofqPBWBFGzOjGNs+LfJL 2RIQVVonJoAe1sZrXfpjpkvFWQNWXjKYy/CCXBXfRfJOZUEq+fVyiC7uLN3TSiJoy/qN mkJFKHGEBOPP/hQVRVwqdjIeeBcg9h0izK8G8PhSg3LBkILhYzUawxbBQmF677BOxb8d C8nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=tuAc2b6j; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id b15-20020aa7cd0f000000b00506c3ce3b23si7084874edw.400.2023.04.24.17.25.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 17:25:06 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=tuAc2b6j; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D8F373858D3C for ; Tue, 25 Apr 2023 00:25:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8F373858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682382305; bh=8VGBkwj1/+ZX+cGKH5M1vYx9UIa9bPxhVPnjJCPD7c0=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=tuAc2b6jxN58oUDhy3PAaS+FICCdX5/rTqKN84wuVlEGH20E8aOLQv3w8skwlZR+1 IHVnaj22jAtcPC00pio/hWC1WyHvHy/ICYDkf2WZadFs0vzr99I4YxKV2F543KuTuK 183h5stW22v4tEH/yW9E5UFB28BbINY9VdOeo/kc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by sourceware.org (Postfix) with ESMTPS id 2AAD93858D1E for ; Tue, 25 Apr 2023 00:24:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2AAD93858D1E Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33OLvSLc015863 for ; Mon, 24 Apr 2023 17:24:15 -0700 Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q4f3p87gg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 24 Apr 2023 17:24:15 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 24 Apr 2023 17:24:13 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 24 Apr 2023 17:24:13 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id E3D713F7058; Mon, 24 Apr 2023 17:24:12 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH 1] Add alternative testcase of phi-opt-25.c that tests phiopt Date: Mon, 24 Apr 2023 17:24:04 -0700 Message-ID: <20230425002404.533283-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 9ixfv-qE2r5cQBNAsgZpH_WInG3N5tfd X-Proofpoint-GUID: 9ixfv-qE2r5cQBNAsgZpH_WInG3N5tfd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-24_12,2023-04-21_01,2023-02-09_01 X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Pinski via Gcc-patches From: Andrew Pinski Reply-To: Andrew Pinski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764105710269361049?= X-GMAIL-MSGID: =?utf-8?q?1764105710269361049?= Right now phi-opt-25.c has tests like `a ? func(a) : CST` but if we add the simplifications to match.pd, then phi-opt-25.c will no longer be testing phiopt to make sure these get optimized. So this adds an alternative version which is designed to test phiopt. Committed as obvious after testing the testcase to make sure it does not fail on x86_64-linux-gnu. Thanks, Andrew Pinski gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/phi-opt-25a.c: New test. --- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25a.c | 89 +++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25a.c diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25a.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25a.c new file mode 100644 index 00000000000..faecac59ee7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25a.c @@ -0,0 +1,89 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +unsigned short test_bswap16(unsigned short x) +{ + if (x) + return __builtin_bswap16(x); + return 0; +} + +unsigned int test_bswap32(unsigned int x) +{ + if (x) + return __builtin_bswap32(x); + return 0; +} + +unsigned long long test_bswap64(unsigned long long x) +{ + if (x) + return __builtin_bswap64(x); + return 0; +} + +int test_clrsb(int x) +{ + if (x) + return __builtin_clrsb(x); + return (__SIZEOF_INT__*8-1); +} + +int test_clrsbl(long x) +{ + if (x) + return __builtin_clrsbl(x); + return (__SIZEOF_LONG__*8-1); +} + +int test_clrsbll(long long x) +{ + if (x) + return __builtin_clrsbll(x); + return (__SIZEOF_LONG_LONG__*8-1); +} + +int test_parity(int x) +{ + if (x) + return __builtin_parity(x); + return 0; +} + +int test_parityl(long x) +{ + if (x) + return __builtin_parityl(x); + return 0; +} + +int test_parityll(long long x) +{ + if (x) + return __builtin_parityll(x); + return 0; +} + +int test_popcount(int x) +{ + if (x) + return __builtin_popcount(x); + return 0; +} + +int test_popcountl(long x) +{ + if (x) + return __builtin_popcountl(x); + return 0; +} + +int test_popcountll(long long x) +{ + if (x) + return __builtin_popcountll(x); + return 0; +} + +/* { dg-final { scan-tree-dump-not "goto" "optimized" } } */ +