2017-12-21 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/82973
+ * emit-rtl.h (valid_for_const_vec_duplicate_p): Rename to ...
+ (valid_for_const_vector_p): ... this.
+ * emit-rtl.c (valid_for_const_vec_duplicate_p): Rename to ...
+ (valid_for_const_vector_p): ... this. Adjust function comment.
+ (gen_vec_duplicate): Adjust caller.
+ * optabs.c (expand_vector_broadcast): Likewise.
+ * simplify-rtx.c (simplify_const_unary_operation): Don't optimize into
+ CONST_VECTOR if some element isn't simplified valid_for_const_vector_p
+ constant.
+ (simplify_const_binary_operation): Likewise. Use CONST_FIXED_P macro
+ instead of GET_CODE == CONST_FIXED.
+ (simplify_subreg): Use CONST_FIXED_P macro instead of
+ GET_CODE == CONST_FIXED.
+
PR target/83488
* config/i386/i386.c (ix86_target_string): Move -mavx512vbmi2 and
-mshstk entries from isa_opts2 to isa_opts and -mhle, -mmovbe,
#endif
}
-/* Return true if X is a valid element for a duplicated vector constant
- of the given mode. */
+/* Return true if X is a valid element for a CONST_VECTOR of the given
+ mode. */
bool
-valid_for_const_vec_duplicate_p (machine_mode, rtx x)
+valid_for_const_vector_p (machine_mode, rtx x)
{
return (CONST_SCALAR_INT_P (x)
|| CONST_DOUBLE_AS_FLOAT_P (x)
rtx
gen_vec_duplicate (machine_mode mode, rtx x)
{
- if (valid_for_const_vec_duplicate_p (mode, x))
+ if (valid_for_const_vector_p (mode, x))
return gen_const_vec_duplicate (mode, x);
return gen_rtx_VEC_DUPLICATE (mode, x);
}
return crtl->emit.x_cur_insn_uid;
}
-extern bool valid_for_const_vec_duplicate_p (machine_mode, rtx);
+extern bool valid_for_const_vector_p (machine_mode, rtx);
extern rtx gen_const_vec_duplicate (machine_mode, rtx);
extern rtx gen_vec_duplicate (machine_mode, rtx);
gcc_checking_assert (VECTOR_MODE_P (vmode));
- if (valid_for_const_vec_duplicate_p (vmode, op))
+ if (valid_for_const_vector_p (vmode, op))
return gen_const_vec_duplicate (vmode, op);
icode = optab_handler (vec_duplicate_optab, vmode);
rtx x = simplify_unary_operation (code, GET_MODE_INNER (mode),
CONST_VECTOR_ELT (op, i),
GET_MODE_INNER (opmode));
- if (!x)
+ if (!x || !valid_for_const_vector_p (mode, x))
return 0;
RTVEC_ELT (v, i) = x;
}
rtx x = simplify_binary_operation (code, GET_MODE_INNER (mode),
CONST_VECTOR_ELT (op0, i),
CONST_VECTOR_ELT (op1, i));
- if (!x)
+ if (!x || !valid_for_const_vector_p (mode, x))
return 0;
RTVEC_ELT (v, i) = x;
}
if (VECTOR_MODE_P (mode)
&& code == VEC_CONCAT
&& (CONST_SCALAR_INT_P (op0)
- || GET_CODE (op0) == CONST_FIXED
+ || CONST_FIXED_P (op0)
|| CONST_DOUBLE_AS_FLOAT_P (op0))
&& (CONST_SCALAR_INT_P (op1)
|| CONST_DOUBLE_AS_FLOAT_P (op1)
- || GET_CODE (op1) == CONST_FIXED))
+ || CONST_FIXED_P (op1)))
{
unsigned n_elts = GET_MODE_NUNITS (mode);
rtvec v = rtvec_alloc (n_elts);
if (CONST_SCALAR_INT_P (op)
|| CONST_DOUBLE_AS_FLOAT_P (op)
- || GET_CODE (op) == CONST_FIXED
+ || CONST_FIXED_P (op)
|| GET_CODE (op) == CONST_VECTOR)
{
/* simplify_immed_subreg deconstructs OP into bytes and constructs
2017-12-21 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/82973
+ * gfortran.dg/pr82973.f90: New test.
+
PR target/83488
* gcc.target/i386/pr83488.c: New test.