https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96466
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rsandifo at gcc dot gnu.org --- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- So there's some weird stuff going along here. We end up with a BLKmode vector<bool> because build_truth_vector_type_for is called with a vector<long> which has DImode (rather than V1DImode - that's stor-layouts fallback). And build_truth_vector_type_for does static tree build_truth_vector_type_for (tree vectype) { machine_mode vector_mode = TYPE_MODE (vectype); poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype); machine_mode mask_mode; if (VECTOR_MODE_P (vector_mode) && targetm.vectorize.get_mask_mode (vector_mode).exists (&mask_mode)) return build_truth_vector_type_for_mode (nunits, mask_mode); poly_uint64 vsize = tree_to_poly_uint64 (TYPE_SIZE (vectype)); unsigned HOST_WIDE_INT esize = vector_element_size (vsize, nunits); tree bool_type = build_nonstandard_boolean_type (esize); return make_vector_type (bool_type, nunits, BLKmode); } where I wonder why we do not use VOIDmode so that layout_type can make an appropriate choice. If we do that then we ICE later during RTL pass: expand t.i: In function 'foo': t.i:10:10: internal compiler error: in int_mode_for_mode, at stor-layout.c:404 10 | v &= x >= v; | ~~^~~~ 0x1270a2c int_mode_for_mode(machine_mode) ../../src/trunk/gcc/stor-layout.c:404 0xd94340 emit_move_via_integer ../../src/trunk/gcc/expr.c:3425 0xd9548d emit_move_insn_1(rtx_def*, rtx_def*) ../../src/trunk/gcc/expr.c:3793 0xd95dc5 emit_move_insn(rtx_def*, rtx_def*) ../../src/trunk/gcc/expr.c:3935 0xd65f48 force_reg(machine_mode, rtx_def*) ../../src/trunk/gcc/explow.c:657 0xf2384e expand_vect_cond_mask_optab_fn ../../src/trunk/gcc/internal-fn.c:2647 0xf27b82 expand_VCOND_MASK ../../src/trunk/gcc/internal-fn.def:146 because of the CONST_INT (DImode...) args with VOIDmode to force_reg in expand_vect_cond_mask_optab_fn: 2642 mask = expand_normal (op0); 2643 rtx_op1 = expand_normal (op1); 2644 rtx_op2 = expand_normal (op2); 2645 2646 mask = force_reg (mask_mode, mask); 2647 rtx_op1 = force_reg (GET_MODE (rtx_op1), rtx_op1); (gdb) p debug_rtx (rtx_op1) (const_int -1 [0xffffffffffffffff]) simply using 'mode' here works and we expand the testcase to bar: .LFB0: .cfi_startproc fmov d1, x0 cmhs d1, d1, d0 and v0.8b, v1.8b, v0.8b ret .cfi_endproc .LFE0: .size bar, .-bar .align 2 .global foo .type foo, %function foo: .LFB1: .cfi_startproc fmov d0, xzr ret