[Bug tree-optimization/69489] missed vectorization for boolean loop, missed if-conversion

amker at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 28 10:47:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69489

--- Comment #17 from amker at gcc dot gnu.org ---
The if-converted loop of the reported test is as:

  <bb 4>:
  # i_27 = PHI <0(3), i_21(5)>
  # n1_29 = PHI <0(3), n1_20(5)>
  # n2_28 = PHI <0(3), n2_34(5)>
  i.1_7 = (sizetype) i_27;
  _9 = u_8(D) + i.1_7;
  _11 = *_9;
  _13 = v_12(D) + i.1_7;
  _14 = *_13;
  _17 = v_12(D) + i.1_7;
  _18 = *_17;
  _31 = _18 != 0;
  _36 = (int) _31;
  _48 = (long int) _36;
  _45 = _11 != 0;
  _44 = _14 == 0;
  _43 = _44 & _45;
  _ifc__40 = _43 ? 1 : 0;
  n2_34 = n2_28 + _ifc__40;
  prephitmp_49 = _11 != 0 ? 0 : _48;
  n1_20 = n1_29 + prephitmp_49;
  i_21 = i_27 + 1;
  if (n_6(D) > i_21)
    goto <bb 5>;
  else
    goto <bb 6>;

  <bb 5>:
  goto <bb 4>;

For stmt: _ifc__40 = _43 ? 1 : 0;  Its pattern_stmt is: patt_37 = patt_38 ? 1 :
0;
Function vectorizable_condition calls expand_vec_cond_expr_p(vectype,
comp_vectype) which we have:

(gdb) call debug_tree(vectype)
 <vector_type 0x7ffff6a5fd20
    type <integer_type 0x7ffff695f930 long int sizes-gimplified public DI
        size <integer_cst 0x7ffff695bca8 constant 64>
        unit size <integer_cst 0x7ffff695bcc0 constant 8>
        align 64 symtab 0 alias set -1 canonical type 0x7ffff695f930 precision
64 min <integer_cst 0x7ffff695bf30 -9223372036854775808> max <integer_cst
0x7ffff695bf48 9223372036854775807>
        pointer_to_this <pointer_type 0x7ffff6980a80>>
    V2DI
    size <integer_cst 0x7ffff695bcf0 type <integer_type 0x7ffff695f2a0
bitsizetype> constant 128>
    unit size <integer_cst 0x7ffff695bd08 type <integer_type 0x7ffff695f1f8
sizetype> constant 16>
    align 128 symtab 0 alias set -1 canonical type 0x7ffff6a5fd20 nunits 2>

(gdb) call debug_tree(comp_vectype)
 <vector_type 0x7ffff6a5fe70
    type <boolean_type 0x7ffff6a5fc78 DI
        size <integer_cst 0x7ffff695bca8 constant 64>
        unit size <integer_cst 0x7ffff695bcc0 constant 8>
        align 64 symtab 0 alias set -1 canonical type 0x7ffff6a5fc78 precision
64 min <integer_cst 0x7ffff6a8f918 -9223372036854775808> max <integer_cst
0x7ffff6a8f948 9223372036854775807>>
    V2DI
    size <integer_cst 0x7ffff695bcf0 type <integer_type 0x7ffff695f2a0
bitsizetype> constant 128>
    unit size <integer_cst 0x7ffff695bd08 type <integer_type 0x7ffff695f1f8
sizetype> constant 16>
    align 128 symtab 0 alias set -1 canonical type 0x7ffff6a5fe70 nunits 2>


In the end, GCC checks HAVE_vcond_mask_v2div2di which is defined as below on
i386:

#define HAVE_vcond_mask_v2div2di (TARGET_SSE4_2)


More information about the Gcc-bugs mailing list