Uros Bizjak <ubiz...@gmail.com> writes: > On Tue, Sep 5, 2017 at 12:35 PM, Alexander Monakov <amona...@ispras.ru> wrote: >> On Tue, 5 Sep 2017, Uros Bizjak wrote: >>> This patch allows to emit memory_blockage pattern instead of default >>> asm volatile as a memory blockage. This patch is needed, so targets >>> (e.g. x86) can define and emit more optimal memory blockage pseudo >>> insn. >> >> Optimal in what sense? What pattern do you intend to use on x86, and >> would any target be able to use the same? > > You don't have to emit a generic asm-like pattern. This is the same > situation as with blockage insn, where targets can emit "blockage" > instead of generic asm insn. > > x86 defines memory_blockage as: > > (define_expand "memory_blockage" > [(set (match_dup 0) > (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BLOCKAGE))] > "" > { > operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); > MEM_VOLATILE_P (operands[0]) = 1; > }) > > However, this definition can't be generic, since unspec is used.
If all ports have switched over to define_c_enum for unspecs (haven't checked), we could probably define something like this in common.md. Thanks, Richard