From: Kugan <kugan.vivekanandarajah@linaro.org>
To: Jakub Jelinek <jakub@redhat.com>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH 0/2] Zext/sext elimination using value range
Date: Tue, 24 Jun 2014 11:48:00 -0000 [thread overview]
Message-ID: <53A9658F.2070304@linaro.org> (raw)
Hi,
This patch series (2) implements zext/sext extension elimination using
value ranges stored in SSA. Implementation is what was suggested in the
thread https://gcc.gnu.org/ml/gcc/2014-05/msg00213.html.
I have broken this into:
Patch 1 - Changes to store zero and sign extended promotions
(SPR_SIGNED_AND_UNSIGNED) in SUBREG with SUBREG_PROMOTED_VAR_P.
Patch 2 - Enables Zext/sext extensions by checking the value range.
test-cases that motivated this and the asm difference with the patch are:
1.
short foo(unsigned char c)
{
c = c & (unsigned char)0x0F;
if( c > 7 )
return((short)(c - 5));
else
return(( short )c);
}
and r0, r0, #15
cmp r0, #7
subhi r0, r0, #5
- uxth r0, r0
- sxth r0, r0
bx lr
2.
unsigned short
crc2(unsigned short crc, unsigned char data)
{
unsigned char i, x16, carry;
for (i = 0; i < 8; i++)
{
x16 = (data ^ crc) & 1;
data >>= 1;
if (x16 == 1)
{
crc ^= 0x4002;
carry = 1;
}
else
carry = 0;
crc >>= 1;
if (carry)
crc |= 0x8000;
else
crc &= 0x7fff;
}
return crc;
}
- mov r3, #8
+ mov r2, #8
.L3:
- eor r2, r1, r0
- sub r3, r3, #1
- tst r2, #1
+ eor r3, r1, r0
mov r1, r1, lsr #1
+ tst r3, #1
eorne r0, r0, #16384
moveq r0, r0, lsr #1
eorne r0, r0, #2
movne r0, r0, lsr #1
orrne r0, r0, #32768
- ands r3, r3, #255
+ subs r2, r2, #1
bne .L3
bx lr
Tested both patches on x86_64-unknown-linux-gnu and
arm-none-linux-gnueabi with no new regressions. Is this OK?
Thanks,
Kugan
next reply other threads:[~2014-06-24 11:48 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-24 11:48 Kugan [this message]
2014-06-24 11:51 ` [PATCH 1/2] Enable setting sign and unsigned promoted mode (SPR_SIGNED_AND_UNSIGNED) Kugan
2014-06-24 12:18 ` Jakub Jelinek
2014-06-25 7:21 ` Kugan
2014-06-25 7:50 ` Jakub Jelinek
2014-06-26 1:06 ` Kugan
2014-06-26 2:48 ` Kugan
2014-06-26 5:50 ` Jakub Jelinek
2014-06-26 9:41 ` Kugan
2014-06-26 10:12 ` Jakub Jelinek
2014-06-26 10:42 ` Jakub Jelinek
2014-07-01 8:21 ` Kugan
2014-07-07 6:52 ` Kugan
2014-07-07 8:06 ` Jakub Jelinek
2014-06-26 10:25 ` Andreas Schwab
2014-07-01 8:28 ` Kugan
2014-06-24 11:53 ` [PATCH 2/2] Enable elimination of zext/sext Kugan
2014-06-24 12:21 ` Jakub Jelinek
2014-06-25 8:15 ` Kugan
2014-06-25 8:36 ` Jakub Jelinek
2014-07-07 6:55 ` Kugan
2014-07-10 12:15 ` Richard Biener
2014-07-11 11:52 ` Kugan
2014-07-11 12:47 ` Richard Biener
2014-07-14 2:58 ` Kugan
2014-07-14 20:11 ` Bernhard Reutner-Fischer
2014-07-23 14:22 ` Richard Biener
2014-08-01 4:51 ` Kugan
2014-08-01 11:16 ` Richard Biener
2014-08-01 16:04 ` Kugan
2014-08-03 23:56 ` Kugan
2014-08-05 14:18 ` Richard Biener
2014-08-05 14:21 ` Jakub Jelinek
2014-08-06 12:09 ` Richard Biener
2014-08-06 13:22 ` Kugan
2014-08-06 13:29 ` Richard Biener
2014-08-07 5:25 ` Kugan
2014-08-07 8:09 ` Richard Biener
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=53A9658F.2070304@linaro.org \
--to=kugan.vivekanandarajah@linaro.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.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).