@@ -11136,7 +11136,20 @@ standard_sse_constant_p (rtx x, machine_mode pred_mode)
/* VOIDmode integer constant, infer mode from the predicate. */
if (mode == VOIDmode)
mode = pred_mode;
-
+ if (CONST_INT_P (x))
+ {
+ /* If mode != VOIDmode, standard_sse_constant_p must be called:
+ 1. On TImode with SSE2.
+ 2. On OImode with AVX2.
+ 3. On XImode with AVX512F.
+ */
+ if ((HOST_WIDE_INT) INTVAL (x) == HOST_WIDE_INT_M1
+ && (mode == VOIDmode
+ || (mode == TImode && TARGET_SSE2)
+ || (mode == OImode && TARGET_AVX2)
+ || (mode == XImode && TARGET_AVX512F)))
+ return 2;
+ }
else if (all_ones_operand (x, VOIDmode))
switch (GET_MODE_SIZE (mode))
{