diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-03-05 10:32:38 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-03-05 10:33:37 +0100 |
commit | aed445b0fd0c7ed16124c61e7eb732992426f103 (patch) | |
tree | cff142f3320908acc29c37ffc9ffa694efcb9246 /libgfortran/runtime/compile_options.c | |
parent | 9d2bc5def30830e685ae2e3c2f4d07b967e2be63 (diff) | |
download | gcc-aed445b0fd0c7ed16124c61e7eb732992426f103.zip gcc-aed445b0fd0c7ed16124c61e7eb732992426f103.tar.gz gcc-aed445b0fd0c7ed16124c61e7eb732992426f103.tar.bz2 |
lower-subreg: Fix ROTATE handling [PR114211]
On the following testcase, we have
(insn 10 7 11 2 (set (reg/v:TI 106 [ h ])
(rotate:TI (reg/v:TI 106 [ h ])
(const_int 64 [0x40]))) "pr114211.c":8:5 1042 {rotl64ti2_doubleword}
(nil))
before subreg1 and the pass decides to use
(reg:DI 127 [ h ]) / (reg:DI 128 [ h+8 ])
register pair instead of (reg/v:TI 106 [ h ]).
resolve_operand_for_swap_move_operator implements it by pretending it is
an assignment from
(concatn (reg:DI 127 [ h ]) (reg:DI 128 [ h+8 ]))
to
(concatn (reg:DI 128 [ h+8 ]) (reg:DI 127 [ h ]))
The problem is that if the rotate argument is the same as destination or
if there is even an overlap between the first half of the destination with
second half of the source we emit incorrect code, because the store to
(reg:DI 128 [ h+8 ]) overwrites what we need for source of the second
move. The following patch detects that case and uses a temporary pseudo
to hold the original (reg:DI 128 [ h+8 ]) value across the first store.
2024-03-05 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/114211
* lower-subreg.cc (resolve_simple_move): For double-word
rotates by BITS_PER_WORD if there is overlap between source
and destination use a temporary.
* gcc.dg/pr114211.c: New test.
Diffstat (limited to 'libgfortran/runtime/compile_options.c')
0 files changed, 0 insertions, 0 deletions