diff mbox

[MIPS,committed] Fix ICE when expanding MSA constant vectors

Message ID 6D39441BF12EF246A7ABCE6654B0235380BE11BF@HHMAIL01.hh.imgtec.org
State New
Headers show

Commit Message

Matthew Fortune March 30, 2017, 10:49 p.m. UTC
This is a fix for a compile failure in gcc.c-torture/compile/pr70240.c
with options -O1 -mmsa.

The expand code for replicated constant vectors with small immediate
values was simply wrong and would never work. This code is not used in the
simple case of initialising a variable with a constant vector from C code; so
focussed test is non-trivial. Since an existing test triggers the issue
then we have basic coverage in place. The whole mips_expand_vector_init
function needs a review and possibly a rewrite as on reading through the
code I see lots of, at least, confusing logic in there which seems
unnecessary.

gcc/
	* config/mips/mips.c (mips_expand_vector_init): Create
	a const_vector to initialise a vector register instead of
	using a const_int.

Committed.

Thanks,
Matthew
diff mbox

Patch

diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index d1deb52..dadfcc4 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -21757,11 +21757,12 @@  mips_expand_vector_init (rtx target, rtx vals)
 		case V8HImode:
 		case V4SImode:
 		case V2DImode:
-		  emit_move_insn (target, same);
+		  temp = gen_rtx_CONST_VECTOR (vmode, XVEC (vals, 0));
+		  emit_move_insn (target, temp);
 		  return;
 
 		default:
-		  break;
+		  gcc_unreachable ();
 		}
 	    }
 	  temp = gen_reg_rtx (imode);