Discussion: What is unspec_volatile?

Paolo Bonzini bonzini@gnu.org
Sat Nov 13 16:20:00 GMT 2010


On 11/13/2010 03:34 PM, H.J. Lu wrote:
> On Sat, Nov 13, 2010 at 2:27 AM, Paolo Bonzini<bonzini@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 
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.

Paolo



More information about the Gcc mailing list