This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Attached (RFC!) patch implements vectorization of int -> double conversion. The testcase:
/* int -> double */ for (i = 0; i < N; i++) { da[i] = (double) ib[i]; }
.L3: movdqa (%eax,%ecx), %xmm0 cvtdq2pd %xmm0, %xmm1 pshufd $238, %xmm0, %xmm0 movapd %xmm1, (%edx,%eax,2) cvtdq2pd %xmm0, %xmm0 movapd %xmm0, 16(%edx,%eax,2) addl $16, %eax cmpl $128, %eax jne .L3
Regarding the patch: in vectorizable_conversion() we detect (nunits_out == nunits_in / 2) as EXPAND case and handle conversion in the same way as vectorizable_type_promotion(). Unfortunatelly, we need a couple of new tree codes and 4 new optabs to handle signed and unsigned conversion.
Unfortunatelly, if correct optabs are not defined, compilation aborts in vect_transform_stmt():
4351 case type_conversion_vec_info_type: 4352 done = vectorizable_conversion (stmt, bsi, &vec_stmt); 4353 gcc_assert (done); 4354 break;
vectorizable_conversion() returns false when it can't handle EXPAND case due to missing optabs. Sure, we will abort then, but vectorizable_convresion() has many other exits with "false". I'm kind of out of ideas here how transformation should be skipped in this case. This is why the patch is RFC only.
PR tree-optimization/24659 * optabs.h (enum optab_index): Add OTI_vec_unpacks_float_hi, OTI_vec_unpacks_float_lo, OTI_vec_unpacku_float_hi and OTI_vec_unpacku_float_lo. (vec_unpacks_float_hi_optab): Define new macro. (vec_unpacks_float_lo_optab): Ditto. (vec_unpacku_float_hi_optab): Ditto. (vec_unpacku_float_lo_optab): Ditto. * genopinit.c (optabs): Implement vec_unpack[s|u]_[hi|lo]_optab using vec_unpack[s|u]_[hi\lo]_* patterns. * tree-vect-transform.c (vect_gen_widened_results_half): Prototype. (vectorizable_conversion): Handle (nunits_in == nunits_out / 2) and (nunits_out == nunits_in / 2) cases. * optabs.c (optab_for_tree_code) Return vec_unpack[s|u]_float_hi_optab for VEC_UNPACK_FLOAT_HI_EXPR and vec_unpack[s|u]_float_lo_optab for VEC_UNPACK_FLOAT_LO_EXPR. (init_optabs): Initialize vec_unpack[s|u]_[hi|lo]_optab.
* tree.def (VEC_UNPACK_FLOAT_HI_EXPR, VEC_UNPACK_FLOAT_LO_EXPR): New tree codes. * tree-pretty-print.c (dump_generic_node): Handle VEC_UNPACK_FLOAT_HI_EXPR and VEC_UNPACK_FLOAT_LO_EXPR. (op_prio): Ditto. * expr.c (expand_expr_real_1): Ditto. * tree-inline.c (estimate_num_insns_1): Ditto. * tree-vect-generic.c (expand_vector_operations_1): Ditto.
* config/i386/sse.md (vec_unpacks_float_hi_v4si): New expander. (vec_unpacks_float_lo_v4si): Ditto.
PR tree-optimization/24659 * gcc.dg/vect/vect-float-intfloat-3.c: New test.
Attachment:
vect-intfloat.diff
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |