This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New RTL instruction for my port


EPILOGUE_USES does not seem to work, the code still gets optimized out.

However, unspec_volatile works but then, as you have said, the
compiler doesn't optimize out things that it then could.

I have for example an instruction to set this special register.
Theoretically, if we had :

set (x);
set (y);

The compiler should remove the first set. Which it does if I remove
the volatile but keep a retrieval of the special register in the
function.

Any other ideas by any chance?

Thanks again,
Jc

On Tue, Dec 15, 2009 at 10:20 AM, Daniel Jacobowitz <drow@false.org> wrote:
> On Tue, Dec 15, 2009 at 10:08:02AM -0500, Jean Christophe Beyler wrote:
>> You are correct. So I should be changing things in the adjust_cost
>> function instead.
>>
>> I was also wondering, these instructions modify an internal register
>> that has been set as a fixed register. However, the compiler optimizes
>> them out when the accumulator is not retrieved for a calculation. How
>> can I tell the compiler that it should not remove these instructions.
>>
>> Here is an example code:
>>
>> uint64_t foo (uint64_t x, uint64_t y)
>> {
>> uint64_t z;
>>
>> __builtin_newins (x,y); /* Modifies the accumulator */
>>
>> z = __builtin_retrieve_accum (); /* Retrieve the accumulator */
>>
>> return z;
>> }
>>
>> If I remove the instruction "z = ...;", then the compiler will
>> optimize out my first builtin call.
>
> I suppose you could use EPILOGUE_USES to say that changes to the
> accumulator should not be discarded. ?You could also use
> unspec_volatile instead of unspec, but that may further inhibit
> optimization.
>
> --
> Daniel Jacobowitz
> CodeSourcery
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]