public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Georg-Johann Lay <avr@gjlay.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [Patch] PR56064: Fold VIEW_CONVERT_EXPR with FIXED_CST, Take #2
Date: Wed, 30 Jan 2013 10:36:00 -0000	[thread overview]
Message-ID: <CAFiYyc03iZ0mJsXsNx5Sr42AgG-Vxjhvs1Sy8Noak4DZY3ZTPA@mail.gmail.com> (raw)
In-Reply-To: <51082A51.9010501@gjlay.de>

On Tue, Jan 29, 2013 at 9:00 PM, Georg-Johann Lay <avr@gjlay.de> wrote:
> Richard Biener wrote:
>> Georg-Johann Lay wrote:
>>> This is tentative patch as discussed in
>>>
>>> http://gcc.gnu.org/ml/gcc/2013-01/msg00187.html
>>>
>>> fold-const.c gets 2 new function native_encode_fixed and
>>> native_interpret_fixed.  Code common with the integer case is factored out and
>>> moved to the new constructor-like function double_int::from_buffer.
>>>
>>> The code bootstraps fine on x86-linux-gnu and I have test coverage from
>>> avr-unknown-none.
>>>
>>> Ok to apply?
>>
>> Ok.
>>
>> Thanks,
>> Richard.
>
> Let me drop this, I don't like the name "const_fixed_from_double_int".  It's
> bad and I think "fixed_from_double_int" is better.  Other constructor-like
> functions for FIXED_VALUE_TYPE use fixed_from_* whereas const_fixed_* returns a
> CONST_FIXED rtx.
>
> This is less confusing and fits better the naming convention.
>
> The new patch also adds const_fixed_from_double_int that actually returns a
> CONST_FIXED rtx.  It's unused, but I would use it in the avr back.
>
> Okay with that rename? (Or, at your option, without const_fixed_from_double_int).

Ok.

Thanks,
Richard.

> Johann
>
>
>         PR tree-optimization/56064
>         * fixed-value.c (fixed_from_double_int): New function.
>         * fixed-value.h (fixed_from_double_int): New prototype.
>         (const_fixed_from_double_int): New static inline function.
>         * fold-const.c (native_interpret_fixed): New static function.
>         (native_interpret_expr) <FIXED_POINT_TYPE>: Use it.
>         (can_native_interpret_type_p) <FIXED_POINT_TYPE>: Return true.
>         (native_encode_fixed): New static function.
>         (native_encode_expr) <FIXED_CST>: Use it.
>         (native_interpret_int): Move double_int worker code to...
>         * double-int.c (double_int::from_buffer): ...this new static method.
>         * double-int.h (double_int::from_buffer): Prototype it.
>
> testsuite/
>         PR tree-optimization/56064
>         * gcc.dg/fixed-point/view-convert.c: New test.
>
>
>
>>
>>> There are less intrusive solutions that only handle the int <-> fixed cases,
>>> for example fold-const.c:fold_view_convert_expr() could test for these cases
>>> and use double_int directly without serializing / deserializing through a
>>> memory buffer.
>>>
>>> Johann
>>>
>>>
>>>         PR tree-optimization/56064
>>>         * fixed-value.c (const_fixed_from_double_int): New function.
>>>         * fixed-value.h (const_fixed_from_double_int): New prototype.
>>>         * fold-const.c (native_interpret_fixed): New static function.
>>>         (native_interpret_expr) <FIXED_POINT_TYPE>: Use it.
>>>         (can_native_interpret_type_p) <FIXED_POINT_TYPE>: Return true.
>>>         (native_encode_fixed): New static function.
>>>         (native_encode_expr) <FIXED_CST>: Use it.
>>>         (native_interpret_int): Move double_int worker code to...
>>>         * double-int.c (double_int::from_buffer): ...this new static method.
>>>         * double-int.h (double_int::from_buffer): Prototype it.
>>>
>>> testsuite/
>>>         PR tree-optimization/56064
>>>         * gcc.dg/fixed-point/view-convert.c: New test.
>>
>

      reply	other threads:[~2013-01-30 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-21 13:29 [Patch] PR56064: Fold VIEW_CONVERT_EXPR with FIXED_CST Georg-Johann Lay
2013-01-29 11:27 ` Richard Biener
2013-01-29 20:00   ` [Patch] PR56064: Fold VIEW_CONVERT_EXPR with FIXED_CST, Take #2 Georg-Johann Lay
2013-01-30 10:36     ` Richard Biener [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=CAFiYyc03iZ0mJsXsNx5Sr42AgG-Vxjhvs1Sy8Noak4DZY3ZTPA@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=avr@gjlay.de \
    --cc=gcc-patches@gcc.gnu.org \
    /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).