]> git.ipfire.org Git - thirdparty/gcc.git/commit
x86: Insert extra move for mode size smaller than natural size
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 30 Apr 2025 22:30:41 +0000 (06:30 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 7 May 2025 08:34:08 +0000 (16:34 +0800)
commitb8c4b6aa8e0521770c6f9fd48dd13dd85e3a2fc9
tree264d8fba621ce27c7ce66aef16a52483f4381ae1
parentae987baeb5fb70877fd007db80b77e374f676c76
x86: Insert extra move for mode size smaller than natural size

When generating a SUBREG from V16QI to V2HF, validate_subreg fails since
V2HF is a floating point vector and its size (4 bytes) is smaller than its
natural size (word size).  Insert an extra move with a QI vector SUBREG of
the same size to avoid validate_subreg failure.

gcc/

PR target/120036
* config/i386/i386-features.cc (ix86_get_vector_load_mode):
Handle 8/4/2 bytes.
(remove_redundant_vector_load): If the mode size is smaller than
its natural size, first insert an extra move with a QI vector
SUBREG of the same size to avoid validate_subreg failure.

gcc/testsuite/

PR target/120036
* g++.target/i386/pr120036.C: New test.
* gcc.target/i386/pr117839-3a.c: Likewise.
* gcc.target/i386/pr117839-3b.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
gcc/config/i386/i386-features.cc
gcc/testsuite/g++.target/i386/pr120036.C [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr117839-3a.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr117839-3b.c [new file with mode: 0644]