For historical reasons AArch64 has TI mode vector types but does not consider
TImode a vector mode.
What's happening in the PR is that get_vectype_for_scalar_type is returning
vector(1) TImode for a TImode scalar. This then fails when we call
targetm.vectorize.get_mask_mode (vecmode).exists (&) on the TYPE_MODE.
This checks for vector mode before using the results of
get_vectype_for_scalar_type.
gcc/ChangeLog:
PR target/116074
* tree-vect-patterns.cc (vect_recog_cond_store_pattern): Check vector mode.
gcc/testsuite/ChangeLog:
PR target/116074
* g++.target/aarch64/pr116074.C: New test.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+int m[40];
+
+template <typename k> struct j {
+ int length;
+ k *e;
+ void operator[](int) {
+ if (length)
+ __builtin___memcpy_chk(m, m+3, sizeof (k), -1);
+ }
+};
+
+j<j<int>> o;
+
+int *q;
+
+void ao(int i) {
+ for (; i > 0; i--) {
+ o[1];
+ *q = 1;
+ }
+}
machine_mode mask_mode;
machine_mode vecmode = TYPE_MODE (vectype);
- if (targetm.vectorize.conditional_operation_is_expensive (IFN_MASK_STORE)
+ if (!VECTOR_MODE_P (vecmode)
+ || targetm.vectorize.conditional_operation_is_expensive (IFN_MASK_STORE)
|| !targetm.vectorize.get_mask_mode (vecmode).exists (&mask_mode)
|| !can_vec_mask_load_store_p (vecmode, mask_mode, false))
return NULL;