On Sat, Aug 15, 2020 at 10:18:27AM +0000, Pip Cet wrote: > > > What I'm currently doing is this: > > > > > > (define_split > > > [(set (match_operand 0 "nonimmediate_operand") > > > (match_operand 1 "nox_general_operand"))] > > > "reload_completed && mov_clobbers_cc (insn, operands)" > > > [(parallel [(set (match_dup 0) (match_dup 1)) > > > (clobber (reg:CC REG_CC))])]) > > > > > > which, if I understand correctly, introduces the parallel-clobber > > > expression only when necessary, at the same time as post-reload > > > splitters introduce REG_CC references. Is that correct? > > > > Yes. And this will work correctly if somehow you ensure that REG_CC > > isn't live anywhere you introduce such a clobber. > > IIUC, the idea is that references to REG_CC, except for clobbers, are > only introduced in the post-reload split pass, so it cannot be live > before our define_split runs. Does that make sense?
Yes, it does. It has some huge restrictions (using the reg in inline assembler can never work reliably, for example, so you'll have to disallow that). And earlier passes (like combine) cannot optimise this, etc. But it is a pretty straightforward way to move from CC0 to the modern world! Segher