Fix incorrect optimization by cprop_hardreg.
authorliuhongt <hongtao.liu@intel.com>
Mon, 18 Jan 2021 08:55:32 +0000 (16:55 +0800)
committerliuhongt <hongtao.liu@intel.com>
Thu, 21 Jan 2021 05:28:59 +0000 (13:28 +0800)
commite711b67a9081ae84c66174a50705dc98ba993a43
tree3cbe5c7f545a56672b983b3652e7c58762773300
parentb93d0e36c0a86c3d15310fe7383321ca63aeb04d
Fix incorrect optimization by cprop_hardreg.

If SRC had been assigned a mode narrower than the copy, we can't
always link DEST into the chain even they have same
hard_regno_nregs(i.e. HImode/SImode in i386 backend).

i.e
        kmovw   %k0, %edi
        vmovd   %edi, %xmm2
vpshuflw        $0, %xmm2, %xmm0
        kmovw   %k0, %r8d
        kmovd   %k0, %r9d
...
-  movl %r9d, %r11d
+  vmovd %xmm2, %r11d

gcc/ChangeLog:

PR rtl-optimization/98694
* regcprop.c (copy_value): If SRC had been assigned a mode
narrower than the copy, we can't link DEST into the chain even
they have same hard_regno_nregs(i.e. HImode/SImode in i386
backend).

gcc/testsuite/ChangeLog:

PR rtl-optimization/98694
* gcc.target/i386/pr98694.c: New test.
gcc/regcprop.c
gcc/testsuite/gcc.target/i386/pr98694.c [new file with mode: 0644]