diff mbox

PATCH: PR target/60827: Inconsistent optimize_function_for_speed_p in in *fixuns_trunc<mode>_1

Message ID 20140411201649.GA6750@intel.com
State New
Headers show

Commit Message

H.J. Lu April 11, 2014, 8:16 p.m. UTC
Since fixuns_trunc<mode>si2 expander checks optimize_insn_for_size_p
before generating *fixuns_trunc<mode>_1,  we should use
optimize_insn_for_speed_p in *fixuns_trunc<mode>_1 for consistency.
OK for trunk?

Thanks.


H.J.
---
2014-04-11  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/60827
	* config/i386/i386.md (*fixuns_trunc<mode>_1): Check
	optimize_insn_for_speed_p instead of
	optimize_function_for_speed_p.

---
 gcc/config/i386/i386.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Uros Bizjak April 14, 2014, 4:31 p.m. UTC | #1
On Fri, Apr 11, 2014 at 10:16 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Since fixuns_trunc<mode>si2 expander checks optimize_insn_for_size_p
> before generating *fixuns_trunc<mode>_1,  we should use
> optimize_insn_for_speed_p in *fixuns_trunc<mode>_1 for consistency.
> OK for trunk?
>
> Thanks.
>
>
> H.J.
> ---
> 2014-04-11  H.J. Lu  <hongjiu.lu@intel.com>
>
>         PR target/60827
>         * config/i386/i386.md (*fixuns_trunc<mode>_1): Check
>         optimize_insn_for_speed_p instead of
>         optimize_function_for_speed_p.

It looks to me that many, if not all
optimize_function_for_{speed,size}_p predicates in .md files should be
converted to corresponding optimize_insn_for_*_p predicates. The later
predicates apply to BBs, so IMO insn sequences should be handled
according to BB frequencies, not function frequencies.

The patch is OK for mainline.

Thanks,
Uros.
Jan Hubicka April 14, 2014, 4:49 p.m. UTC | #2
> On Fri, Apr 11, 2014 at 10:16 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> > Since fixuns_trunc<mode>si2 expander checks optimize_insn_for_size_p
> > before generating *fixuns_trunc<mode>_1,  we should use
> > optimize_insn_for_speed_p in *fixuns_trunc<mode>_1 for consistency.
> > OK for trunk?
> >
> > Thanks.
> >
> >
> > H.J.
> > ---
> > 2014-04-11  H.J. Lu  <hongjiu.lu@intel.com>
> >
> >         PR target/60827
> >         * config/i386/i386.md (*fixuns_trunc<mode>_1): Check
> >         optimize_insn_for_speed_p instead of
> >         optimize_function_for_speed_p.
> 
> It looks to me that many, if not all
> optimize_function_for_{speed,size}_p predicates in .md files should be
> converted to corresponding optimize_insn_for_*_p predicates. The later
> predicates apply to BBs, so IMO insn sequences should be handled
> according to BB frequencies, not function frequencies.

You can not convert all predicates, only those in expanders.
The predicates in insn templates must be consistent thorough the compilation
since the insn may come from hot BB to cold BB and you do not want it to become
unrecognizable.

Honza
> 
> The patch is OK for mainline.
> 
> Thanks,
> Uros.
Uros Bizjak April 14, 2014, 4:54 p.m. UTC | #3
On Mon, Apr 14, 2014 at 6:49 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> On Fri, Apr 11, 2014 at 10:16 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> > Since fixuns_trunc<mode>si2 expander checks optimize_insn_for_size_p
>> > before generating *fixuns_trunc<mode>_1,  we should use
>> > optimize_insn_for_speed_p in *fixuns_trunc<mode>_1 for consistency.
>> > OK for trunk?
>> >
>> > Thanks.
>> >
>> >
>> > H.J.
>> > ---
>> > 2014-04-11  H.J. Lu  <hongjiu.lu@intel.com>
>> >
>> >         PR target/60827
>> >         * config/i386/i386.md (*fixuns_trunc<mode>_1): Check
>> >         optimize_insn_for_speed_p instead of
>> >         optimize_function_for_speed_p.
>>
>> It looks to me that many, if not all
>> optimize_function_for_{speed,size}_p predicates in .md files should be
>> converted to corresponding optimize_insn_for_*_p predicates. The later
>> predicates apply to BBs, so IMO insn sequences should be handled
>> according to BB frequencies, not function frequencies.
>
> You can not convert all predicates, only those in expanders.
> The predicates in insn templates must be consistent thorough the compilation
> since the insn may come from hot BB to cold BB and you do not want it to become
> unrecognizable.

Ops, thanks for sharing this. Based on this explanation, the patch
isn't correct. H.J., please revert it.

Thanks,
Uros.
diff mbox

Patch

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 25e2e93..80ebe54 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -4367,7 +4367,7 @@ 
    (clobber (match_scratch:<ssevecmode> 1 "=x,&x"))
    (clobber (match_scratch:<ssevecmode> 2 "=x,x"))]
   "!TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH
-   && optimize_function_for_speed_p (cfun)"
+   && optimize_insn_for_speed_p ()"
   "#"
   "&& reload_completed"
   [(const_int 0)]