[PR68432 00/26] Handle size/speed choices for internal functions

Richard Sandiford richard.sandiford@arm.com
Thu Nov 26 15:43:00 GMT 2015


Bernd Schmidt <bschmidt@redhat.com> writes:
> On 11/25/2015 01:20 PM, Richard Sandiford wrote:
>> This series fixes PR 68432, a regression caused by my internal-functions-
>> for-optabs series.  Some of the libm optabs in i386.md have a true HAVE_*
>> condition but conditionally FAIL if we're optimising for size:
>>
>>    if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
>>        && !flag_trapping_math)
>>      {
>>        if (TARGET_ROUND)
>> 	emit_insn (gen_sse4_1_round<mode>2
>> 		   (operands[0], operands[1], GEN_INT (ROUND_MXCSR)));
>>        else if (optimize_insn_for_size_p ())
>>          FAIL;
>>        else
>> 	ix86_expand_rint (operands[0], operands[1]);
>>      }
>
> How many such cases are there? Is it just the ix86 patterns?

Yeah, just x86 AFAICT.

> And, could the same effect be achieved by just moving the
> optimize_insn_for_size_p test into the predicate (as some existing
> patterns already do), and then testing the predicate while ensuring
> that optimize_insn_for_x returns the right value?

That would mean that the validity of a gimple call would depend on both
the target predicates and whether the block containing the statement
is optimised for size or speed.  So whenever we want to test whether
a gimple call is valid, we'd need to generate rtl for its arguments
and pass them to the target predicates.  We'd also need to be aware
that moving a call between blocks could make it invalid (because
we might be moving a call from a block optimised for speed to a block
optimised for size).  I don't think those are the kinds of thing that
gimple passes would normally expect.

It seems better to use FAILs and predicates for correctness only
and use other ways of representing size/speed decisions.  And since we
already have another way for rtl, it seems like a good idea to use it
for gimple too.

Thanks,
Richard



More information about the Gcc-patches mailing list