This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
- From: Mike Stump <mikestump at comcast dot net>
- To: DJ Delorie <dj at redhat dot com>
- Cc: law at redhat dot com, rguenther at suse dot de, polacek at redhat dot com, gcc-patches at gcc dot gnu dot org, joseph at codesourcery dot com, jakub at redhat dot com
- Date: Wed, 6 Aug 2014 14:30:32 -0700
- Subject: Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
- Authentication-results: sourceware.org; auth=none
- References: <20140804101856 dot GB24292 at redhat dot com> <alpine dot LSU dot 2 dot 11 dot 1408041224210 dot 20733 at zhemvz dot fhfr dot qr> <20140804113836 dot GD24292 at redhat dot com> <alpine dot LSU dot 2 dot 11 dot 1408041404040 dot 20733 at zhemvz dot fhfr dot qr> <20140805143652 dot GG24292 at redhat dot com> <53E13B1D dot 5050401 at redhat dot com> <20140806082219 dot GI24292 at redhat dot com> <alpine dot LSU dot 2 dot 11 dot 1408061021280 dot 20733 at zhemvz dot fhfr dot qr> <53E25225 dot 8050407 at redhat dot com> <BD5E0F45-E282-41EF-AEF4-14C1FC92D2FA at comcast dot net> <201408061945 dot s76Jj4sl019016 at greed dot delorie dot com>
On Aug 6, 2014, at 12:45 PM, DJ Delorie <dj@redhat.com> wrote:
>
>> What’s PSImode?
>
> PSImode is a mode with more precision than HImode, but less than SImode.
:-) I phrase it this way, there is no PSImode anymore in gcc. It is gone, the concept is gone. Some ports can choose to create a mode for the port with that name, and attach any semantics they want to it, below are some examples:
config/avr/avr-modes.def:FRACTIONAL_INT_MODE (PSI, 24, 3);
config/m32c/m32c-modes.def:PARTIAL_INT_MODE (SI, 24, PSI);
config/msp430/msp430-modes.def:PARTIAL_INT_MODE (SI, 20, PSI);
config/sh/sh-modes.def:PARTIAL_INT_MODE (SI, 22, PSI);
On such systems, the name refers to exactly what ever mode is defined. By convention, it is usually no larger than SImode, however, the note about more precision than HImode, well, that’s wrong for my port. I have a P1DI mode with a width of 64 bits, and a precision of 1.
> There's still lots of places in gcc that use SIZE where they should
> use PRECISION.
Yes, and in time, they’ll all get cleaned up.
> I also added a step that looks for target-defined
> conversions between, for example, HImode and PSImode (rather than go
> HI->SI->PSI).
I hope they always fall back to the usual conversions. On my port, I can move them into gprs and do all the usual gpr instructions on them. The register allocator allocates the mode specific registers and moves them around as appropriate.