diff mbox

[i386,5/8,AVX-512] Extend vectorizer hooks.

Message ID CAFULd4a7KMHMXH18yN6sJkz-Yg3FO5fyPYzAwi7r-zQChuidAg@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Dec. 22, 2013, 10:47 a.m. UTC
On Wed, Dec 18, 2013 at 2:07 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
> Hello,
>
> On 02 Dec 16:13, Kirill Yukhin wrote:
>> Hello,
>> On 19 Nov 12:14, Kirill Yukhin wrote:
>> > Hello,
>> > On 15 Nov 20:10, Kirill Yukhin wrote:
>> > > > Is it ok to commit to main trunk?
>> > > Ping.
>> > Ping.
>> Ping.
> Ping.
>
> Updated patch in the bottom.

This patch actually implements AVX512F arguments passing ABI and insn
sequences generation for basic vector functionality (I guess these
expanders were referred as "hooks"). Looking at the title, I expected
most changes in ix86_builtin_vectorized_function, but IIRC, I have
seen these in another patch.

@@ -18629,6 +18713,11 @@ ix86_expand_vector_convert_uns_vsivsf (rtx
target, rtx val)
   enum machine_mode fltmode = GET_MODE (target);
   rtx (*cvt) (rtx, rtx);

+  if (intmode == V16SImode)
+    {
+      emit_insn (gen_ufloatv16siv16sf2 (target, val));
+      return;
+    }
   if (intmode == V4SImode)

Please put the above directly in the sse.md expander. Use static mode
checks in .md files (see below).

@@ -3555,11 +3556,17 @@
    (match_operand:VF1 1 "register_operand")]
   "TARGET_SSE2"
 {
-  rtx tmp[3];
-  tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
-  tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
-  emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
-  emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
+  if (GET_MODE (operands[1]) == V16SFmode)
+    emit_insn (gen_ufix_truncv16sfv16si2 (operands[0],
+  operands[1]));
+  else

Please use static mode checks in the form of "if (<MODE>mode ==
V16SFmode)" in the .md files. The <MODE> will be substituted from VF1
mode iterator in the C source before compilation.

2013-11-12  Alexander Ivchenko  <alexander.ivchenko@intel.com>
            Maxim Kuznetsov  <maxim.kuznetsov@intel.com>
            Sergey Lega  <sergey.s.lega@intel.com>
            Anna Tikhonova  <anna.tikhonova@intel.com>
            Ilya Tocar  <ilya.tocar@intel.com>
            Andrey Turetskiy  <andrey.turetskiy@intel.com>
            Ilya Verbin  <ilya.verbin@intel.com>
            Kirill Yukhin  <kirill.yukhin@intel.com>
            Michael Zolotukhin  <michael.v.zolotukhin@intel.com>

        * config/i386/i386.c (MAX_CLASSES): Increase number of classes.
        (classify_argument): Extend for 512 bit vectors.
        (construct_container): Ditto.
        (function_arg_advance_32): Ditto.
        (function_arg_advance_64): Ditto.
        (function_arg_32): Ditto.
        (function_arg_64): Ditto.
        (function_value_32): Ditto.
        (return_in_memory_32): Ditto.
        (ix86_gimplify_va_arg): Ditto.
        (standard_sse_constant_p): Ditto.
        (standard_sse_constant_opcode): Ditto.
        (ix86_expand_vector_convert_uns_vsivsf): Ditto.
        (ix86_build_const_vector): Ditto.
        (ix86_build_signbit_mask): Ditto.
        (ix86_expand_sse_cmp): Extend for AVX512.
        (ix86_expand_sse_movcc): Ditto.
        (ix86_expand_int_vcond): Ditto.
        (ix86_expand_vec_perm): Ditto.
        (ix86_expand_sse_unpack): Ditto.
        (ix86_constant_alignment): Ditto.
        (avx_vpermilp_parallel): Ditto.
        (ix86_rtx_costs): Ditto.
        (ix86_expand_vector_init_duplicate): Ditto.
        (ix86_expand_vector_init_concat): Ditto.
        (ix86_expand_vector_init_general): Ditto.
        (ix86_expand_vector_extract): Ditto.
        (emit_reduc_half): Ditto.
        (ix86_vector_mode_supported_p): Ditto.
        (ix86_emit_swdivsf): Ditto.
        (ix86_emit_swsqrtsf): Ditto.
        (expand_vec_perm_1): Ditto.
        (ix86_vectorize_vec_perm_const_ok): Ditto.
        (ix86_expand_mul_widen_evenodd): Ditto.
        (ix86_expand_sse2_mulvxdi3): Ditto.
        (ix86_preferred_simd_mode): Ditto.
        (ix86_autovectorize_vector_sizes): Ditto.
        (ix86_expand_vec_perm_vpermi2): New.
        (ix86_vector_duplicate_value): Ditto.
        * config/i386/sse.md
(fixuns_trunc<mode><sseintvecmodelower>2): Extend for AVX512.
        (vec_pack_ufix_trunc_<mode>): Ditto.
        * tree-vect-stmts.c (vectorizable_load): Support AVX512's gathers.
        * tree-vectorizer.h (MAX_VECTORIZATION_FACTOR): Extend for 512
bit vectors.

I assumed the same testing procedure as described in the original submission:

Testing:
  1. Bootstrap pass.
  2. make check shows no regressions.
  3. Spec 2000 & 2006 build show no regressions both with and without
-mavx512f option.
  4. Spec 2000 & 2006 run shows no stability regressions without
-mavx512f option.

The x86 part is OK for mainline. You will also need approval from the
middle-end reviewer for tree-* parts.

Thanks,
Uros.

Comments

Jakub Jelinek Dec. 22, 2013, 12:52 p.m. UTC | #1
On Sun, Dec 22, 2013 at 11:47:52AM +0100, Uros Bizjak wrote:
>         * tree-vect-stmts.c (vectorizable_load): Support AVX512's gathers.
>         * tree-vectorizer.h (MAX_VECTORIZATION_FACTOR): Extend for 512
> bit vectors.
> 
> I assumed the same testing procedure as described in the original submission:
> 
> Testing:
>   1. Bootstrap pass.
>   2. make check shows no regressions.
>   3. Spec 2000 & 2006 build show no regressions both with and without
> -mavx512f option.
>   4. Spec 2000 & 2006 run shows no stability regressions without
> -mavx512f option.
> 
> The x86 part is OK for mainline. You will also need approval from the
> middle-end reviewer for tree-* parts.

The tree parts are ok for trunk, but likely insufficient by now,
you need similar changes for vectorizable_mask_load_store (which also
handles gathers), plus verify even the non-gather mask load/store if they
don't need any tweaking for AVX512F (integer masks rather than vector
ones?).

	Jakub
diff mbox

Patch

diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 99f6b1f..da08020 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -5636,7 +5636,7 @@  vectorizable_load (gimple stmt,
gimple_stmt_iterator *gsi, gimple *vec_stmt,

This (minor) change should be reviewed by a middle-end reviewer.

BTW: I didn't find (updated?) ChangeLog anywhere in the message, so i
took the one from the original submission: