Richard Sandiford via Gcc-patches <gcc-patches@gcc.gnu.org> writes: > Prathamesh Kulkarni <prathamesh.kulka...@linaro.org> writes: >> Sorry to ask a silly question but in which case shall we select 2nd vector ? >> For num_poly_int_coeffs == 2, >> a1 /trunc n1 == (a1 + 0x) / (n1.coeffs[0] + n1.coeffs[1]*x) >> If a1/trunc n1 succeeds, >> 0 / n1.coeffs[1] == a1/n1.coeffs[0] == 0. >> So, a1 has to be < n1.coeffs[0] ? > > Remember that a1 is itself a poly_int. It's not necessarily a constant. > > E.g. the TRN1 .D instruction maps to a VEC_PERM_EXPR with the selector: > > { 0, 2 + 2x, 1, 4 + 2x, 2, 6 + 2x, ... }
Sorry, should have been: { 0, 2 + 2x, 2, 4 + 2x, 4, 6 + 2x, ... } > which is an interleaving of the two patterns: > > { 0, 2, 4, ... } a0 = 0, a1 = 2, S = 2 > { 2 + 2x, 4 + 2x, 6 + 2x } a0 = 2 + 2x, a1 = 4 + 2x, S = 2