]> git.ipfire.org Git - thirdparty/gcc.git/commit
Relax ix86_hardreg_mov_ok after split1.
authorliuhongt <hongtao.liu@intel.com>
Mon, 22 Jul 2024 03:36:59 +0000 (11:36 +0800)
committerliuhongt <hongtao.liu@intel.com>
Tue, 23 Jul 2024 05:53:05 +0000 (13:53 +0800)
commita3f03891065cb9691f6e9cebce4d4542deb92a35
treef912b073080afbb0585a2f1626750331229b4693
parentf4062e361cccc5a32597afdb6c8066c87f680276
Relax ix86_hardreg_mov_ok after split1.

ix86_hardreg_mov_ok is added by r11-5066-gbe39636d9f68c4

>    The solution proposed here is to have the x86 backend/recog prevent
>    early RTL passes composing instructions (that set likely_spilled hard
>    registers) that they (combine) can't simplify, until after reload.
>    We allow sets from pseudo registers, immediate constants and memory
>    accesses, but anything more complicated is performed via a temporary
>    pseudo.  Not only does this simplify things for the register allocator,
>    but any remaining register-to-register moves are easily cleaned up
>    by the late optimization passes after reload, such as peephole2 and
>    cprop_hardreg.

The restriction is mainly for rtl optimization passes before pass_combine.

But split1 splits

```
(insn 17 13 18 2 (set (reg/i:V4SI 20 xmm0)
        (vec_merge:V4SI (const_vector:V4SI [
                    (const_int -1 [0xffffffffffffffff]) repeated x4
                ])
            (const_vector:V4SI [
                    (const_int 0 [0]) repeated x4
                ])
            (unspec:QI [
                    (reg:V4SF 106)
                    (reg:V4SF 102)
                    (const_int 0 [0])
                ] UNSPEC_PCMP))) "/app/example.cpp":20:1 2929 {*avx_cmpv4sf3_1}
     (expr_list:REG_DEAD (reg:V4SF 102)
        (expr_list:REG_DEAD (reg:V4SF 106)
            (nil))))
```

into:
```
(insn 23 13 24 2 (set (reg:V4SF 107)
        (unspec:V4SF [
                (reg:V4SF 106)
                (reg:V4SF 102)
                (const_int 0 [0])
            ] UNSPEC_PCMP)) "/app/example.cpp":20:1 -1
     (nil))
(insn 24 23 18 2 (set (reg/i:V4SI 20 xmm0)
        (subreg:V4SI (reg:V4SF 107) 0)) "/app/example.cpp":20:1 -1
     (nil))
```

There're many splitters generating MOV insn with SUBREG and would have
same problem.
Instead of changing those splitters one by one, the patch relaxes
ix86_hard_mov_ok to allow mov subreg to hard register after
split1. ix86_pre_reload_split () is used to replace
!reload_completed && ira_in_progress.

gcc/ChangeLog:

* config/i386/i386.cc (ix86_hardreg_mov_ok): Relax mov subreg
to hard register after split1.

gcc/testsuite/ChangeLog:

* g++.target/i386/pr115982.C: New test.
gcc/config/i386/i386.cc
gcc/testsuite/g++.target/i386/pr115982.C [new file with mode: 0644]