* [PATCH] simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification of (extend ashiftrt (ashift ..))) Otherwise the gcc_assert can catch when dealing with partial int modes.
@ 2019-07-03 14:12 John Darrington
2019-07-03 20:30 ` [PATCH] simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification Richard Sandiford
0 siblings, 1 reply; 4+ messages in thread
From: John Darrington @ 2019-07-03 14:12 UTC (permalink / raw)
To: gcc-patches; +Cc: John Darrington
---
gcc/ChangeLog | 6 ++++++
gcc/simplify-rtx.c | 8 ++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c206ab6..47035ca 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-07-03 John Darrington <john@darrington.wattle.id.au>
+
+ simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification of
+ (extend ashiftrt (ashift ..))) Otherwise the gcc_assert will catch
+ when dealing with partial int modes.
+
2019-07-02 Eric Botcazou <ebotcazou@adacore.com>
* cfgexpand.c (pass_expand::execute): Deal specially with instructions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 89a46a9..d74a4ba 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1504,12 +1504,12 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
&& CONST_INT_P (XEXP (op, 1))
&& XEXP (XEXP (op, 0), 1) == XEXP (op, 1)
&& (op_mode = as_a <scalar_int_mode> (GET_MODE (op)),
- GET_MODE_BITSIZE (op_mode) > INTVAL (XEXP (op, 1))))
+ GET_MODE_UNIT_PRECISION (op_mode) > INTVAL (XEXP (op, 1))))
{
scalar_int_mode tmode;
- gcc_assert (GET_MODE_BITSIZE (int_mode)
- > GET_MODE_BITSIZE (op_mode));
- if (int_mode_for_size (GET_MODE_BITSIZE (op_mode)
+ gcc_assert (GET_MODE_UNIT_PRECISION (int_mode)
+ > GET_MODE_UNIT_PRECISION (op_mode));
+ if (int_mode_for_size (GET_MODE_UNIT_PRECISION (op_mode)
- INTVAL (XEXP (op, 1)), 1).exists (&tmode))
{
rtx inner =
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification
2019-07-03 14:12 [PATCH] simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification of (extend ashiftrt (ashift ..))) Otherwise the gcc_assert can catch when dealing with partial int modes John Darrington
@ 2019-07-03 20:30 ` Richard Sandiford
2019-07-03 22:35 ` Jeff Law
0 siblings, 1 reply; 4+ messages in thread
From: Richard Sandiford @ 2019-07-03 20:30 UTC (permalink / raw)
To: John Darrington; +Cc: gcc-patches
> diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
> index 89a46a9..d74a4ba 100644
> --- a/gcc/simplify-rtx.c
> +++ b/gcc/simplify-rtx.c
> @@ -1504,12 +1504,12 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
> && CONST_INT_P (XEXP (op, 1))
> && XEXP (XEXP (op, 0), 1) == XEXP (op, 1)
> && (op_mode = as_a <scalar_int_mode> (GET_MODE (op)),
> - GET_MODE_BITSIZE (op_mode) > INTVAL (XEXP (op, 1))))
> + GET_MODE_UNIT_PRECISION (op_mode) > INTVAL (XEXP (op, 1))))
> {
> scalar_int_mode tmode;
> - gcc_assert (GET_MODE_BITSIZE (int_mode)
> - > GET_MODE_BITSIZE (op_mode));
> - if (int_mode_for_size (GET_MODE_BITSIZE (op_mode)
> + gcc_assert (GET_MODE_UNIT_PRECISION (int_mode)
> + > GET_MODE_UNIT_PRECISION (op_mode));
> + if (int_mode_for_size (GET_MODE_UNIT_PRECISION (op_mode)
> - INTVAL (XEXP (op, 1)), 1).exists (&tmode))
> {
> rtx inner =
I think these should be GET_MODE_PRECISION rather than
GET_MODE_UNIT_PRECISION. They do the same thing in this context,
but it seems odd to use GET_MODE_UNIT_... when we're specifically
dealing with scalars.
Looks good otherwise (and small enough not to need a copyright assignment,
in case you haven't signed one).
Thanks,
Richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification
2019-07-03 20:30 ` [PATCH] simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification Richard Sandiford
@ 2019-07-03 22:35 ` Jeff Law
2019-07-04 5:06 ` John Darrington
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2019-07-03 22:35 UTC (permalink / raw)
To: John Darrington, gcc-patches, richard.sandiford
On 7/3/19 2:17 PM, Richard Sandiford wrote:
>> diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
>> index 89a46a9..d74a4ba 100644
>> --- a/gcc/simplify-rtx.c
>> +++ b/gcc/simplify-rtx.c
>> @@ -1504,12 +1504,12 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
>> && CONST_INT_P (XEXP (op, 1))
>> && XEXP (XEXP (op, 0), 1) == XEXP (op, 1)
>> && (op_mode = as_a <scalar_int_mode> (GET_MODE (op)),
>> - GET_MODE_BITSIZE (op_mode) > INTVAL (XEXP (op, 1))))
>> + GET_MODE_UNIT_PRECISION (op_mode) > INTVAL (XEXP (op, 1))))
>> {
>> scalar_int_mode tmode;
>> - gcc_assert (GET_MODE_BITSIZE (int_mode)
>> - > GET_MODE_BITSIZE (op_mode));
>> - if (int_mode_for_size (GET_MODE_BITSIZE (op_mode)
>> + gcc_assert (GET_MODE_UNIT_PRECISION (int_mode)
>> + > GET_MODE_UNIT_PRECISION (op_mode));
>> + if (int_mode_for_size (GET_MODE_UNIT_PRECISION (op_mode)
>> - INTVAL (XEXP (op, 1)), 1).exists (&tmode))
>> {
>> rtx inner =
>
> I think these should be GET_MODE_PRECISION rather than
> GET_MODE_UNIT_PRECISION. They do the same thing in this context,
> but it seems odd to use GET_MODE_UNIT_... when we're specifically
> dealing with scalars.
>
> Looks good otherwise (and small enough not to need a copyright assignment,
> in case you haven't signed one).
John, I assume you're doing this for an out of tree port (s12z?)?
Otherwise it'd also be useful if you could include a test which triggers
the assert.
If you could confirm that Richard's suggestion of using
GET_MODE_PRECISION rather than GET_MODE_UNIT_PRECISION works it'd be
appreciated.
Thanks,
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification
2019-07-03 22:35 ` Jeff Law
@ 2019-07-04 5:06 ` John Darrington
0 siblings, 0 replies; 4+ messages in thread
From: John Darrington @ 2019-07-04 5:06 UTC (permalink / raw)
To: Jeff Law; +Cc: John Darrington, gcc-patches, richard.sandiford
On Wed, Jul 03, 2019 at 04:32:54PM -0600, Jeff Law wrote:
John, I assume you're doing this for an out of tree port (s12z?)?
That is correct.
Otherwise it'd also be useful if you could include a test which triggers
the assert.
Once I have the other aspects of the port sorted out I can create a test
case (although it wouldn't be necessary because it happens building
libgcc).
If you could confirm that Richard's suggestion of using
GET_MODE_PRECISION rather than GET_MODE_UNIT_PRECISION works it'd be
appreciated.
I had wondered about the difference between the two. Unfortunately,
neither are mentioned in gccint.texinfo - I ended up deciding upon
GET_MOE_UNIT_PRECISION because there is a similar situation a few lines
above in simplify-rtx.c which uses it.
If GET_MODE_UNIT_PRECISION is inappropriate, then please change it.
Regards,
John
--
Avoid eavesdropping. Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-04 5:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 14:12 [PATCH] simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification of (extend ashiftrt (ashift ..))) Otherwise the gcc_assert can catch when dealing with partial int modes John Darrington
2019-07-03 20:30 ` [PATCH] simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification Richard Sandiford
2019-07-03 22:35 ` Jeff Law
2019-07-04 5:06 ` John Darrington
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).