[PATCH v6] x86_64: Correct THREAD_SETMEM/THREAD_SETMEM_NC for movq [BZ #27591]

H.J. Lu hjl.tools@gmail.com
Tue Mar 16 16:50:58 GMT 2021


On Tue, Mar 16, 2021 at 9:34 AM Carlos O'Donell <carlos@redhat.com> wrote:
>
> On 3/16/21 12:10 PM, Florian Weimer via Libc-alpha wrote:
> > * Andreas Schwab:
> >
> >> I don't think this will work in general.  Wouldn't it be possible that
> >> an operands optimizes to a 64-bit constant in later passes?  What you
> >> really need is a constraint that only matches a 32-bit immediate or a
> >> register.  Like "rWf"?

config/i386/constraints.md in GCC has

(define_constraint "e"
  "32-bit signed integer constant, or a symbolic reference known
   to fit that range (for immediate operands in sign-extending x86-64
   instructions)."
  (match_operand 0 "x86_64_immediate_operand"))

"er" is the correct constraint for movq.

> > Maybe we should to the __seg_fs namespace instead?  Wouldn't that avoid
> > these issues?
>
> It might.
>
> HJ, Does it work to rewrite this using __seg_fs?

I tried it.  GCC generates worse code.

> Otherwise I'll review v5, which I think is better than it was before and
> makes forward progress.

Here is the v6 patch to use the "er" constraint.   OK for master?

Thanks.


-- 
H.J.


More information about the Libc-alpha mailing list