From: Jeff Law <jeffreyalaw@gmail.com>
To: liuhongt <hongtao.liu@intel.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Enhance optimize_atomic_bit_test_and to handle truncation.
Date: Tue, 23 Nov 2021 10:56:59 -0700 [thread overview]
Message-ID: <f75c3d74-60cb-ad2a-5576-7c06874968f6@gmail.com> (raw)
In-Reply-To: <20211117052005.91656-1-hongtao.liu@intel.com>
On 11/16/2021 10:20 PM, liuhongt via Gcc-patches wrote:
> r12-5102-gfb161782545224f5 improves integer bit test on
> __atomic_fetch_[or|and]_* returns only for nop_convert, .i.e.
>
> transfrom
>
> mask_5 = 1 << bit_4(D);
> mask.0_1 = (unsigned int) mask_5;
> _2 = __atomic_fetch_or_4 (a_7(D), mask.0_1, 0);
> t1_9 = (int) _2;
> t2_10 = mask_5 & t1_9;
>
> to
>
> mask_5 = 1 << n_4(D);
> mask.1_1 = (unsigned int) mask_5;
> _11 = .ATOMIC_BIT_TEST_AND_SET (&pscc_a_1_4, n_4(D), 0);
> _8 = (int) _11;
>
> And this patch extend the original patch to handle truncation.
> .i.e.
>
> transform
>
> long int mask;
> mask_8 = 1 << n_7(D);
> mask.0_1 = (long unsigned int) mask_8;
> _2 = __sync_fetch_and_or_8 (&pscc_a_2_3, mask.0_1);
> _3 = (unsigned int) _2;
> _4 = (unsigned int) mask_8;
> _5 = _3 & _4;
> _6 = (int) _5;
>
> to
>
> long int mask;
> mask_8 = 1 << n_7(D);
> mask.0_1 = (long unsigned int) mask_8;
> _14 = .ATOMIC_BIT_TEST_AND_SET (&pscc_a_2_3, n_7(D), 0);
> _5 = (unsigned int) _14;
> _6 = (int) _5;
>
> Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}
> Ok for trunk?
>
> 2021-11-17 Hongtao Liu <hongtao.liu@intel.com>
> H.J. Lu <hongjiu.lu@intel.com>
>
> gcc/ChangeLog:
>
> PR tree-optimization/103194
> * match.pd (gimple_nop_atomic_bit_test_and_p): Extended to
> match truncation.
> * tree-ssa-ccp.c (gimple_nop_convert): Declare.
> (optimize_atomic_bit_test_and): Enhance
> optimize_atomic_bit_test_and to handle truncation.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/i386/pr103194-2.c: New test.
> * gcc.target/i386/pr103194-3.c: New test.
> * gcc.target/i386/pr103194-4.c: New test.
> * gcc.target/i386/pr103194-5.c: New test.
> * gcc.target/i386/pr103194.c: New test.
OK
jeff
prev parent reply other threads:[~2021-11-23 17:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 5:20 liuhongt
2021-11-23 17:56 ` Jeff Law [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f75c3d74-60cb-ad2a-5576-7c06874968f6@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hongtao.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).