On Sat, Nov 13, 2010 at 6:56 AM, Paolo Bonzini <bonz...@gnu.org> wrote: > On 11/13/2010 03:34 PM, H.J. Lu wrote: >> >> On Sat, Nov 13, 2010 at 2:27 AM, Paolo Bonzini<bonz...@gnu.org> wrote: >>> >>> On 11/12/2010 03:25 PM, H.J. Lu wrote: >>>> >>>> IRA may move instructions across an unspec_volatile, >>> >>> Do you have a testcase? >>> >> >> x86 has >> >> ;; Clear the upper 128bits of AVX registers, equivalent to a NOP >> ;; if the upper 128bits are unused. >> (define_insn "avx_vzeroupper" >> [(unspec_volatile [(match_operand 0 "const_int_operand" "")] >> UNSPECV_VZEROUPPER)] >> "TARGET_AVX" >> "vzeroupper" >> [(set_attr "type" "sse") >> (set_attr "modrm" "0") >> (set_attr "memory" "none") >> (set_attr "prefix" "vex") >> (set_attr "mode" "OI")]) >> >> It is no-nop, but it has to be in the place where it was expanded. >> Since there is no register operand, IRA moves instructions across >> it. We have to undo IRA moves in ix86_reorg. > > That's because VZEROUPPER (and VZEROALL too, btw) has input and output
Please pay close attention to VZEROALL, which I enclosed below. > operands that you are not modeling. Undoing these moves in reorg seems very > wrong to me, even though you need it anyway to delete them. > VZEROUPPER is no-nop to executions. But it isn't no-nop for performance. That is why no instructions should be moved across it. But IRA doesn't support this. -- H.J. -- (define_insn "*avx_vzeroall" [(match_parallel 0 "vzeroall_operation" [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])] "TARGET_AVX" "vzeroall" [(set_attr "type" "sse") (set_attr "modrm" "0") (set_attr "memory" "none") (set_attr "prefix" "vex") (set_attr "mode" "OI")])