Re-instantiate integer mask to traditional vector mask support

Message ID 20231018081831.A7A333856943@sourceware.org
State Unresolved
Headers
Series Re-instantiate integer mask to traditional vector mask support |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Richard Biener Oct. 18, 2023, 8:17 a.m. UTC
  The following allows to pass integer mask data as traditional
vector mask for OMP SIMD clone calls which is required due to
the limited set of OMP SIMD clones in the x86 ABI when using
AVX512 but a prefered vector size of 256 bits.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	* tree-vect-stmts.cc (vectorizable_simd_clone_call):
	Relax check to again allow passing integer mode masks
	as traditional vectors.
---
 gcc/tree-vect-stmts.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 9bb43e98f56..338c84d7f09 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -4384,9 +4384,16 @@  vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
 		i = -1;
 		break;
 	      case SIMD_CLONE_ARG_TYPE_MASK:
+		/* While we can create a traditional data vector from
+		   an incoming integer mode mask we have no good way to
+		   force generate an integer mode mask from a traditional
+		   boolean vector input.  */
 		if (SCALAR_INT_MODE_P (n->simdclone->mask_mode)
-		    != SCALAR_INT_MODE_P (TYPE_MODE (arginfo[i].vectype)))
+		    && !SCALAR_INT_MODE_P (TYPE_MODE (arginfo[i].vectype)))
 		  i = -1;
+		else if (!SCALAR_INT_MODE_P (n->simdclone->mask_mode)
+			 && SCALAR_INT_MODE_P (TYPE_MODE (arginfo[i].vectype)))
+		  this_badness += 2048;
 		break;
 	      }
 	    if (i == (size_t) -1)