[Patch] MIPS: Improve HI and QI atomic memory ops.
Richard Sandiford
rsandifo@nildram.co.uk
Mon May 5 21:52:00 GMT 2008
David Daney <ddaney@avtrex.com> writes:
> In addition to doing "oldval == const0_rtx", It seems that we only need
> to mask the values if they are negative constants. So I made the
> masking operation conditional.
Unfortunately, it isn't safe to avoid the mask for variables either.
gen_lowpart (SImode, (reg:QI foo)) returns an rtx in which the upper
24 bits are undefined. They might hold zero sometimes, but they
aren't guaranteed to.
I suppose we could avoid the mask for positive constants, but at this
stage, I think it's probably best to drop the special cases altogether.
We should be able to optimize away the constant ops later.
(I wondered about saying that before, for the const0_rtx case.
But that was such a simple shortcut that I didn't mind much
either way. Now that we have other potential shortcuts,
it seems more consistent to take none.)
So the patch is OK if you simply add:
mips_emit_binary (AND, old_shifted, old_shifted, mask);
and:
mips_emit_binary (AND, new_shifted, new_shifted, mask);
to the existing code, without any of the other mips.c stuff.
Richard
More information about the Gcc-patches
mailing list