Hi guys, While looking at Spec2006/401.bzip2 I found such a loop: for (i = 1; i <= alphaSize; i++) { j = weight[i] >> 8; j = 1 + (j / 2); weight[i] = j << 8; }
Which is not vectorizeble (using Intel's AVX2) because division by two is not recognized as rshift: 5: ==> examining statement: D.3785_6 = j_5 / 2; 5: vect_is_simple_use: operand j_5 5: def_stmt: j_5 = D.3784_4 >> 8; 5: type of def: 3. 5: vect_is_simple_use: operand 2 5: op not supported by target. 5: not vectorized: relevant stmt not supported: D.3785_6 = j_5 / 2; However, while expanding, it is successfully turned into shift: (insn 42 41 43 6 (parallel [ (set (reg:SI 107) (ashiftrt:SI (reg:SI 106) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) 1.c:7 -1 (expr_list:REG_EQUAL (div:SI (reg:SI 103) (const_int 2 [0x2])) (nil))) `Division by power of 2` conversion into shift seems to be beneficial at all. My question is, what is in your opinion best way to do such a conversion? Obvious solution will be to introduce dedicated pass which will convert all such a cases. We also may try to implement dedicated expand, but I have no idea, how to specify in the name (if possible) that second operand is something fixed. Any help is appreciated. Thanks, K