Question on movsi and movdi

Segher Boessenkool segher@kernel.crashing.org
Wed Jan 22 13:59:00 GMT 2020


Hi!

On Wed, Jan 22, 2020 at 12:06:02PM +0100, Henri Cloetens wrote:
> Simplified, it looks as follows:
> 
> (define_insn "movdi"
>   [(set (match_operand:DI 0 "blueproc_nonimmediate_operand" "=r,r,m")
>         (match_operand:DI 1 "input_operand" "r,m,r"))]
> 
> - The options 2 (m to r) and 3 (r to m), that is clear.
> - The option 1 (r to r), the processor has no instruction for it. It 

What you call "options 1, 2, and 3" are called "alternatives 0, 1, and 2".

> needs to be translated to
>    2x the movsi instruction. Now, I would prefer to avoid duplicating 
> the code written under the
>    'movsi', and call the movsi definition.
>    Q. Is this possible ?.

Of course ;-)

>      I mean, I found it can be done with define_split, but then the 
> compiler gets confused, splits the
>      instruction, and cannot do the rename any more to avoid the 
> copying.
>      (There are cases where it should rename, and cases where it should 
> copy.) So, it should be done
>      in the define_insn, but I find no way to do it.

This is one of the cases where you want to split only when
reload_completed.  So your split condition might be
  "reload_completed && which_alternative == 0"
for example.

HTH,


Segher



More information about the Gcc-help mailing list