https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48609
--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Kyrylo Tkachov <[email protected]>: https://gcc.gnu.org/g:9b7a8311b4e5501deff697fe68dc4d62d63a9bd9 commit r17-6582-g9b7a8311b4e5501deff697fe68dc4d62d63a9bd9 Author: Kyrylo Tkachov <[email protected]> Date: Tue Nov 17 06:48:52 2026 -0800 simplify-rtx: Check mode tieability when merging VEC_CONCAT of subregs The VEC_CONCAT simplification added for PR target/48609 in b085ae4b49b4 rewrites (vec_concat:N (subreg:N/2 OP 0) (subreg:N/2 OP N/2)) into a lowpart of OP without checking that the target allows accessing OP in the result mode. On AArch64, V2x8QI (two D registers) and V16QI (one Q register) have the same size but cannot be tied. The vtbl2 and vtbx2 expanders build the table with aarch64_combinev8qi from the two halves of a V2x8QI tuple, so combine now produces (set (reg:V16QI table) (subreg:V16QI (reg:V2x8QI tuple) 0)) which reload can only satisfy through the stack: sub sp, sp, #16 stp d0, d1, [sp] ldr q31, [sp] tbl v0.8b, {v31.16b}, v2.8b add sp, sp, 16 ret Require targetm.modes_tieable_p for register bases, so the VEC_CONCAT is kept and the code is: zip1 v0.2d, v0.2d, v1.2d tbl v0.8b, {v0.16b}, v2.8b ret The vtbl2 and vtbx2 tests in gcc.target/aarch64/neon expected the stack sequence, so update them to the new code. This also fixes the test_tbl2 and test_tbx2 failures in gcc.target/aarch64/simd/mf8_data_1.c. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ChangeLog: * simplify-rtx.cc (simplify_context::simplify_binary_operation_1) <case VEC_CONCAT>: Check targetm.modes_tieable_p before merging subregs of the same register. gcc/testsuite/ChangeLog: * gcc.target/aarch64/neon/vtbl.c: Expect zip1 instead of a stack round trip for vtbl2. * gcc.target/aarch64/neon/vtbx.c: Likewise for vtbx2. Signed-off-by: Kyrylo Tkachov <[email protected]>
