diff mbox series

[3/9] i386 changes to adjust vec_perm_const hook

Message ID CAAgBjMnNOOSzEqFktSwSw-4a36tO1xmQxkHQ0bjQU0Kp+gZ64A@mail.gmail.com
State New
Headers show
Series None | expand

Commit Message

Prathamesh Kulkarni May 18, 2022, 11:17 a.m. UTC
Hi,
The attached patch adjusts vec_perm_const hook to accommodate the new parameter.
For rationale, please see:
https://gcc.gnu.org/pipermail/gcc-patches/2022-May/595128.html
Bootstrapped+tested on x86_64-linux-gnu.
OK to commit ?

Thanks,
Prathamesh
diff mbox series

Patch

diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 806e1f5aaa3..87f02d62338 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -22060,9 +22060,12 @@  canonicalize_perm (struct expand_vec_perm_d *d)
 /* Implement TARGET_VECTORIZE_VEC_PERM_CONST.  */
 
 bool
-ix86_vectorize_vec_perm_const (machine_mode vmode, rtx target, rtx op0,
-			       rtx op1, const vec_perm_indices &sel)
+ix86_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode, rtx target,
+			       rtx op0, rtx op1, const vec_perm_indices &sel)
 {
+  if (vmode != op_mode)
+    return false;
+
   struct expand_vec_perm_d d;
   unsigned char perm[MAX_VECT_LEN];
   unsigned int i, nelt, which;
diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.h
index 9d320c29552..6c650196c9c 100644
--- a/gcc/config/i386/i386-expand.h
+++ b/gcc/config/i386/i386-expand.h
@@ -48,8 +48,9 @@  rtx gen_push (rtx arg);
 rtx gen_pop (rtx arg);
 rtx ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
 			 machine_mode mode, int ignore);
-bool ix86_vectorize_vec_perm_const (machine_mode vmode, rtx target, rtx op0,
-				    rtx op1, const vec_perm_indices &sel);
+bool ix86_vectorize_vec_perm_const (machine_mode vmode, machine_mode op_mode,
+				    rtx target, rtx op0, rtx op1,
+				    const vec_perm_indices &sel);
 bool ix86_notrack_prefixed_insn_p (rtx_insn *);
 machine_mode ix86_split_reduction (machine_mode mode);
 void ix86_expand_divmod_libfunc (rtx libfunc, machine_mode mode, rtx op0,
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 175ce013e5d..50112a8efee 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -15836,7 +15836,7 @@ 
 	      sel[7] = 15;
 	    }
 	  vec_perm_indices indices (sel, 2, 8);
-	  bool ok = targetm.vectorize.vec_perm_const (V8SImode, target,
+	  bool ok = targetm.vectorize.vec_perm_const (V8SImode, V8SImode, target,
 						      arg0, arg1, indices);
 	  gcc_assert (ok);
 	  emit_move_insn (operands[0],
@@ -24569,7 +24569,7 @@ 
 	      sel[3] = 7;
 	    }
 	  vec_perm_indices indices (sel, arg0 != arg1 ? 2 : 1, 4);
-	  bool ok = targetm.vectorize.vec_perm_const (V4SImode, target,
+	  bool ok = targetm.vectorize.vec_perm_const (V4SImode, V4SImode, target,
 						      arg0, arg1, indices);
 	  gcc_assert (ok);
 	  emit_move_insn (operands[0],