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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Jakub Jelinek from comment #3)
> Started with r233107.
> 
> Slightly adjusted testcase:
> 
> __int128 a;
> int b;
> 
> void
> bar (__int128 *x)
> {
>   if (*x != 0)
>     {
>       a = 0;
>       b = b <= *x;
>     }
> }
> 
> void
> foo (unsigned int x)
> {
>   bar (x + 1);
> }
> 
> This is on
> (mem:TI (zero_extend:DI (plus:SI (reg/v:SI 91 [ x ]) (const_int 1 [0x1]))))
> which matches the predicate of the *movti_internal instruction -
> general_operand, but the selected alternative needs offsettable memory.
> LRA attempts:
> (mem:DI (plus:DI (zero_extend:DI (plus:SI (reg/v:SI 91 [ x ])
>                 (const_int 1 [0x1])))
>         (const_int 8 [0x8])) [1 *_3+8 S8 A64])
> but that isn't a valid offsettable address, it should have instead forced
> the zero_extend into a register.
> 
> Or should some reload hook in the backend tell LRA that it should do that if
> it wants an offsettable address out of that?

This should be handled in ix86_secondary_reload TARGET_SECONDARY_RELOAD hook,
which has the code to handle

  /* Double-word spills from general registers to non-offsettable memory
     references (zero-extended addresses) require special handling.  */

via reload_noff_{load,store} patterns.

Reply via email to