On Wed, Nov 16, 2011 at 12:18 PM, Joern Rennecke <amyl...@spamcop.net> wrote: > Quoting Ian Lance Taylor <i...@google.com>: > >> Offhand I don't know of any way to get the compiler to save CC for you >> around your instruction. That's a stiff requirement. > > It's easy to do under explicit control of the pattern, using (a) > match_scratch > clobber(s) of (a) register(s) of the required class(es) - or if memory is > needed, the stack top can be set aside by the prologue/epilogue code. >
So I suppose with (clobber (reg:CC FLAGS_REG)), the compiler will be capable to know this register will be modified in this instruction and apply proper behavior when necessary? Here is the code: (define_insn "spc_insn" [(set (match_operand:DI 0 "register_operand" "=r") (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")] UNSPEC_SPC)) (clobber (reg:CC FLAGS_REG))] Thanks, Feng