https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116043

Hongtao Liu <liuhongt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |liuhongt at gcc dot 
gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #15 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---

> I think we can exclude case when base and index are both NULL_RTX, let's
> always use *mov{si,di}_internal pattern to move const to register.

No, i misunderstood the issue, it's not the problem of lea pattern, it's the
address of gottpoff shouldn't be reloaded.

In PR103275, r12-5445-gb5844cb0bc8c7d9be2ff1ecded249cad82b9b71c added new
constraint "Bk" to avoid kmovq        foo@gottpoff(%rip), %k0, but RA may still
allocates k/v register and try to reload for address since it thought the cost
of reload address is cheap?

Adjust "Bk" to define_special_memory_constraint to avoid address reload can
solve the issue.

modified   gcc/config/i386/constraints.md                                       
@@ -187,7 +187,7 @@ (define_special_memory_constraint "Bm"                      
   "@internal Vector memory operand."                                           
   (match_operand 0 "vector_memory_operand"))                                   

-(define_memory_constraint "Bk"                                                 
+(define_special_memory_constraint "Bk"                                         
   "@internal TLS address that allows insn using non-integer registers."        
   (and (match_operand 0 "memory_operand")                                      
        (not (match_test "ix86_gpr_tls_address_pattern_p (op)")))) 

I'm testing the patch.

Reply via email to