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