#endif
printf ("#define CONST_MODE_IBIT%s\n", adj_ibit ? "" : " const");
printf ("#define CONST_MODE_FBIT%s\n", adj_fbit ? "" : " const");
+ printf ("#define CONST_MODE_MASK%s\n", adj_nunits ? "" : " const");
emit_max_int ();
for_all_modes (c, m)
int c;
struct mode_data *m;
- print_decl ("unsigned HOST_WIDE_INT", "mode_mask_array",
- "NUM_MACHINE_MODES");
+ print_maybe_const_decl ("%sunsigned HOST_WIDE_INT", "mode_mask_array",
+ "NUM_MACHINE_MODES", adj_nunits);
puts ("\
#define MODE_MASK(m) \\\n\
((m) >= HOST_BITS_PER_WIDE_INT) \\\n\
struct mode_adjust *a;
struct mode_data *m;
+ if (adj_nunits)
+ printf ("\n"
+ "void\n"
+ "adjust_mode_mask (machine_mode mode)\n"
+ "{\n"
+ " unsigned int precision;\n"
+ " if (GET_MODE_PRECISION (mode).is_constant (&precision)\n"
+ " && precision < HOST_BITS_PER_WIDE_INT)\n"
+ " mode_mask_array[mode] = (HOST_WIDE_INT_1U << precision) - 1;"
+ "\n"
+ " else\n"
+ " mode_mask_array[mode] = HOST_WIDE_INT_M1U;\n"
+ "}\n");
+
puts ("\
\nvoid\
\ninit_adjust_machine_modes (void)\
printf (" int old_factor = vector_element_size"
" (mode_precision[E_%smode], mode_nunits[E_%smode]);\n",
m->name, m->name);
- printf (" mode_precision[E_%smode] = ps * old_factor;\n", m->name);
+ printf (" mode_precision[E_%smode] = ps * old_factor;\n", m->name);
printf (" mode_size[E_%smode] = exact_div (mode_precision[E_%smode],"
" BITS_PER_UNIT);\n", m->name, m->name);
printf (" mode_nunits[E_%smode] = ps;\n", m->name);
+ printf (" adjust_mode_mask (E_%smode);\n", m->name);
printf (" }\n");
}
/* Get a bitmask containing 1 for all bits in a word
that fit within mode MODE. */
-extern const unsigned HOST_WIDE_INT mode_mask_array[NUM_MACHINE_MODES];
+extern CONST_MODE_MASK unsigned HOST_WIDE_INT
+ mode_mask_array[NUM_MACHINE_MODES];
#define GET_MODE_MASK(MODE) mode_mask_array[MODE]
--- /dev/null
+/* { dg-options "-O3 -msve-vector-bits=512" } */
+
+long c;
+int a;
+int e[14];
+short b[14];
+void d(long *f, long h) { *f ^= h + *f; }
+void this_test_has_completed_successfully ();
+int main() {
+ e[2] = 1;
+ for (int g = 0; g < 13; g++)
+ a = b[g] = e[g];
+ d(&c, a);
+ for (int g = 0; g < 4; g++)
+ d(&c, b[2]);
+ if (c != 15)
+ __builtin_abort();
+ this_test_has_completed_successfully ();
+}
+
+/* { dg-final { scan-assembler {this_test_has_completed_successfully} } } */