diff mbox

[SPARC] Do not create bogus CONST_VECTORs

Message ID 2557035.q25ApMOt6M@polaris
State New
Headers show

Commit Message

Eric Botcazou Oct. 16, 2016, 7:38 p.m. UTC
The compiler was creating bogus CONST_VECTORs under specific circumstances in 
sparc_expand_vector_init.  Fixed by using the same test as the x86 back-end.

Tested on SPARC/Solaris, applied on all active branches.


2016-10-16  Eric Botcazou  <ebotcazou@adacore.com>

	* config/sparc/sparc.c (sparc_expand_vector_init): Only accept literal
	constants in CONST_VECTORs.
diff mbox

Patch

Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 241205)
+++ config/sparc/sparc.c	(working copy)
@@ -12366,14 +12366,13 @@  sparc_expand_vector_init (rtx target, rt
   const machine_mode inner_mode = GET_MODE_INNER (mode);
   const int n_elts = GET_MODE_NUNITS (mode);
   int i, n_var = 0;
-  bool all_same;
+  bool all_same = true;
   rtx mem;
 
-  all_same = true;
   for (i = 0; i < n_elts; i++)
     {
       rtx x = XVECEXP (vals, 0, i);
-      if (!CONSTANT_P (x))
+      if (!(CONST_SCALAR_INT_P (x) || CONST_DOUBLE_P (x) || CONST_FIXED_P (x)))
 	n_var++;
 
       if (i > 0 && !rtx_equal_p (x, XVECEXP (vals, 0, 0)))