Incrementing volatiles?
Jeffrey A Law
law@cygnus.com
Wed Jul 15 17:22:00 GMT 1998
In message < 35AD22FF.7436@tssc.co.nz >you write:
> Jeffrey A Law wrote:
> > But you can not increment without first reading its value.
>
> However, if the CPU supports `atomic' increments (most if not all CISC
> cpus), then it should be used.
They're already used whenever possible.
> Hmm, I seem to have been mis-understood. I was not proposing a change
> to the meaning of volatile. What I was saying is that new RTXs should
> be created for the increment and friends orperators.
>
> Ouch I just realised why I was probably misunderstood. I mean
> insn-patterns, not RTXs. In fact, I don't think new RTXs would be
> needed. Maybe an example would help (i386):
>
> (define_expand "incsi"
> [(set (match_operand:SI 0 "nonimmediate_operand" "")
> (plus:SI (match_dup 0)
> (match_dup 1)))]
> ""
This is better handled by the standard patterns which can check the
arguments, and if they are the same produce a 2 operand add.
In general, if you find yourself proposing new RTX codes, or new
named patterns, then you're probably heading down the wrong path.
jeff
More information about the Gcc
mailing list