On Wed, Jun 15, 2016 at 09:22:20AM +0000, Bin Cheng wrote: > + rtx mask = gen_reg_rtx (<V_cmp_result>mode); > + enum rtx_code code = GET_CODE (operands[3]); > + > + emit_insn (gen_vec_cmp<mode><v_cmp_result>_internal (mask, operands[3], > + operands[4], operands[5])); > + /* See comments of vec_cmp<mode><v_cmp_result>_internal, the opposite > + result masks are computed for below operators, we need to invert > + the mask here. In this case we can save an inverting instruction > + by simply swapping the two operands to bsl. */ > + if (code == NE || code == UNEQ || code == UNLT || code == UNLE > + || code == UNGT || code == UNGE || code == UNORDERED) > + std::swap (operands[1], operands[2]);
With regards to my comments on patch 1/2 - do you not get the same code-gen if you change those functions to always generate the correct mask, and add a second invert here before swapping the operands. The two mask inverts should simplify to nothing, and you'd clean up the design? Thanks, James