From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1314) id 2277E3858D1E; Tue, 25 Apr 2023 00:26:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2277E3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682382363; bh=nu4dRfYunE1sO0EvdQdr53CueGpAfDSuL7u6soe7iug=; h=From:To:Subject:Date:From; b=mJj6KnO2EAkxq0HYM1vCHCeLc+YPPHblUXegkRn7dXoyo28qecUXEPrW9K7JwTk+b 1SkLlEKRCBxnSaXH4zJzssjNYzJ2YnzGAwscGHCN/8KRJ2uRwKxWllWvivXwLrYim+ Cbe0kxQMht1nBBnErT5yGcmTTuUM8HuFDJmxQvOE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andrew Pinski To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-209] Add alternative testcase of phi-opt-25.c that tests phiopt X-Act-Checkin: gcc X-Git-Author: Andrew Pinski X-Git-Refname: refs/heads/trunk X-Git-Oldrev: aeaf942699cc2eecce34e1f55eba6a177644b73e X-Git-Newrev: 966bd96ff78ccf29f37acc6d1fbce50fb96b7836 Message-Id: <20230425002603.2277E3858D1E@sourceware.org> Date: Tue, 25 Apr 2023 00:26:03 +0000 (GMT) List-Id: https://gcc.gnu.org/g:966bd96ff78ccf29f37acc6d1fbce50fb96b7836 commit r14-209-g966bd96ff78ccf29f37acc6d1fbce50fb96b7836 Author: Andrew Pinski Date: Mon Apr 24 17:17:27 2023 -0700 Add alternative testcase of phi-opt-25.c that tests phiopt 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. Diff: --- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25a.c | 89 +++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) 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" } } */ +