With expand_promote_outgoing_argument, op3 in op3 = lowpart_subreg (QImode, op3, HImode);
may not be in HImode. Call lowpart_subreg on op3 only if it isn't integer constant and pass GET_MODE (op3) to lowpart_subreg instead of HImode. PR middle-end/14907 * config/i386/i386-expand.cc (ix86_expand_builtin): Use GET_MODE with lowpart_subreg. Signed-off-by: H.J. Lu <hjl.to...@gmail.com> --- gcc/config/i386/i386-expand.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index ce887d96f6a..4c7aa316ae5 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -15532,7 +15532,8 @@ rdseed_step: op0 = copy_to_mode_reg (GET_MODE (op0), op0); emit_insn (gen (half, op0)); op0 = half; - op3 = lowpart_subreg (QImode, op3, HImode); + if (!CONST_INT_P (op3)) + op3 = lowpart_subreg (QImode, op3, GET_MODE (op3)); break; case IX86_BUILTIN_GATHER3ALTDIV8SF: case IX86_BUILTIN_GATHER3ALTDIV8SI: -- 2.47.0