https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98214
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>: https://gcc.gnu.org/g:0411210fddbd3ec27c8dc1183f40f662712a2232 commit r11-6379-g0411210fddbd3ec27c8dc1183f40f662712a2232 Author: Richard Sandiford <richard.sandif...@arm.com> Date: Thu Dec 31 16:10:47 2020 +0000 genmodes: Update GET_MODE_MASK when changing NUNITS [PR98214] The static GET_MODE_MASKs for SVE vectors are based on the static precisions, which in turn are based on 128-bit SVE. The precisions are later updated based on -msve-vector-bits (usually to become variable length), but the GET_MODE_MASK stayed the same. This caused combine to fold: (*_extract:DI (subreg:DI (reg:VNxMM R) 0) ...) to zero because the extracted bits appeared to be insignificant. gcc/ PR rtl-optimization/98214 * genmodes.c (emit_insn_modes_h): Emit a definition of CONST_MODE_MASK. (emit_mode_mask): Treat mode_mask_array as non-constant if adj_nunits. (emit_mode_adjustments): Update GET_MODE_MASK when updating GET_MODE_NUNITS. * machmode.h (mode_mask_array): Use CONST_MODE_MASK.