From 54967fb0c8c2a1ab5d8fff59446e5fee8d6e79d9 Mon Sep 17 00:00:00 2001 From: Alexander Ivchenko Date: Tue, 14 Oct 2014 08:15:32 +0000 Subject: [PATCH] AVX-512. 59/n. Add vptest[n]m, ucmp, cmpeq insn patterns. gcc/ * config/i386/i386.c (ix86_expand_args_builtin): Handle CODE_FOR_avx512vl_cmpv4di3_mask, CODE_FOR_avx512vl_cmpv8si3_mask, CODE_FOR_avx512vl_ucmpv4di3_mask, CODE_FOR_avx512vl_ucmpv8si3_mask, CODE_FOR_avx512vl_cmpv2di3_mask, CODE_FOR_avx512vl_cmpv4si3_mask, CODE_FOR_avx512vl_ucmpv2di3_mask, CODE_FOR_avx512vl_ucmpv4si3_mask. * config/i386/sse.md (define_insn "avx512f_ucmp3"): Delete. "_ucmp3"):New. (define_insn "_ucmp3"):Ditto. (define_expand "_eq3"): Ditto. (define_insn "_eq3_1"): Ditto. (define_insn "_gt3"): Ditto. (define_insn "_testm3"): Ditto. (define_insn "_testnm3"): Ditto. Co-Authored-By: Andrey Turetskiy Co-Authored-By: Anna Tikhonova Co-Authored-By: Ilya Tocar Co-Authored-By: Ilya Verbin Co-Authored-By: Kirill Yukhin Co-Authored-By: Maxim Kuznetsov Co-Authored-By: Michael Zolotukhin From-SVN: r216177 --- gcc/ChangeLog | 26 ++++++++++ gcc/config/i386/i386.c | 8 ++++ gcc/config/i386/sse.md | 106 ++++++++++++++++++++++++++++++++++------- 3 files changed, 122 insertions(+), 18 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 604e34c0aef..5ee1d70950e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,29 @@ +2014-10-14 Alexander Ivchenko + Maxim Kuznetsov + Anna Tikhonova + Ilya Tocar + Andrey Turetskiy + Ilya Verbin + Kirill Yukhin + Michael Zolotukhin + + * config/i386/i386.c + (ix86_expand_args_builtin): Handle CODE_FOR_avx512vl_cmpv4di3_mask, + CODE_FOR_avx512vl_cmpv8si3_mask, CODE_FOR_avx512vl_ucmpv4di3_mask, + CODE_FOR_avx512vl_ucmpv8si3_mask, CODE_FOR_avx512vl_cmpv2di3_mask, + CODE_FOR_avx512vl_cmpv4si3_mask, CODE_FOR_avx512vl_ucmpv2di3_mask, + CODE_FOR_avx512vl_ucmpv4si3_mask. + * config/i386/sse.md + (define_insn "avx512f_ucmp3"): Delete. + "_ucmp3"):New. + (define_insn + "_ucmp3"):Ditto. + (define_expand "_eq3"): Ditto. + (define_insn "_eq3_1"): Ditto. + (define_insn "_gt3"): Ditto. + (define_insn "_testm3"): Ditto. + (define_insn "_testnm3"): Ditto. + 2014-10-14 Alexander Ivchenko Maxim Kuznetsov Anna Tikhonova diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1c38353cc9c..a485bb18728 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -34108,6 +34108,14 @@ ix86_expand_args_builtin (const struct builtin_description *d, case CODE_FOR_avx512f_cmpv16si3_mask: case CODE_FOR_avx512f_ucmpv8di3_mask: case CODE_FOR_avx512f_ucmpv16si3_mask: + case CODE_FOR_avx512vl_cmpv4di3_mask: + case CODE_FOR_avx512vl_cmpv8si3_mask: + case CODE_FOR_avx512vl_ucmpv4di3_mask: + case CODE_FOR_avx512vl_ucmpv8si3_mask: + case CODE_FOR_avx512vl_cmpv2di3_mask: + case CODE_FOR_avx512vl_cmpv4si3_mask: + case CODE_FOR_avx512vl_ucmpv2di3_mask: + case CODE_FOR_avx512vl_ucmpv4si3_mask: error ("the last argument must be a 3-bit immediate"); return const0_rtx; diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 70cfa6a99ab..99fd5cf75ff 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -2522,11 +2522,25 @@ (set_attr "prefix" "evex") (set_attr "mode" "")]) -(define_insn "avx512f_ucmp3" +(define_insn "_ucmp3" [(set (match_operand: 0 "register_operand" "=Yk") (unspec: - [(match_operand:VI48_512 1 "register_operand" "v") - (match_operand:VI48_512 2 "nonimmediate_operand" "vm") + [(match_operand:VI12_AVX512VL 1 "register_operand" "v") + (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm") + (match_operand:SI 3 "const_0_to_7_operand" "n")] + UNSPEC_UNSIGNED_PCMP))] + "TARGET_AVX512BW" + "vpcmpu\t{%3, %2, %1, %0|%0, %1, %2, %3}" + [(set_attr "type" "ssecmp") + (set_attr "length_immediate" "1") + (set_attr "prefix" "evex") + (set_attr "mode" "")]) + +(define_insn "_ucmp3" + [(set (match_operand: 0 "register_operand" "=Yk") + (unspec: + [(match_operand:VI48_AVX512VL 1 "register_operand" "v") + (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm") (match_operand:SI 3 "const_0_to_7_operand" "n")] UNSPEC_UNSIGNED_PCMP))] "TARGET_AVX512F" @@ -10152,20 +10166,42 @@ (set_attr "prefix" "vex") (set_attr "mode" "OI")]) -(define_expand "avx512f_eq3" +(define_expand "_eq3" + [(set (match_operand: 0 "register_operand") + (unspec: + [(match_operand:VI12_AVX512VL 1 "register_operand") + (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")] + UNSPEC_MASKED_EQ))] + "TARGET_AVX512BW" + "ix86_fixup_binary_operands_no_copy (EQ, mode, operands);") + +(define_expand "_eq3" [(set (match_operand: 0 "register_operand") (unspec: - [(match_operand:VI48_512 1 "register_operand") - (match_operand:VI48_512 2 "nonimmediate_operand")] + [(match_operand:VI48_AVX512VL 1 "register_operand") + (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")] UNSPEC_MASKED_EQ))] "TARGET_AVX512F" "ix86_fixup_binary_operands_no_copy (EQ, mode, operands);") -(define_insn "avx512f_eq3_1" +(define_insn "_eq3_1" [(set (match_operand: 0 "register_operand" "=Yk") (unspec: - [(match_operand:VI48_512 1 "register_operand" "%v") - (match_operand:VI48_512 2 "nonimmediate_operand" "vm")] + [(match_operand:VI12_AVX512VL 1 "register_operand" "%v") + (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] + UNSPEC_MASKED_EQ))] + "TARGET_AVX512F && ix86_binary_operator_ok (EQ, mode, operands)" + "vpcmpeq\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "type" "ssecmp") + (set_attr "prefix_extra" "1") + (set_attr "prefix" "evex") + (set_attr "mode" "")]) + +(define_insn "_eq3_1" + [(set (match_operand: 0 "register_operand" "=Yk") + (unspec: + [(match_operand:VI48_AVX512VL 1 "register_operand" "%v") + (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_EQ))] "TARGET_AVX512F && ix86_binary_operator_ok (EQ, mode, operands)" "vpcmpeq\t{%2, %1, %0|%0, %1, %2}" @@ -10248,11 +10284,11 @@ (set_attr "prefix" "vex") (set_attr "mode" "OI")]) -(define_insn "avx512f_gt3" +(define_insn "_gt3" [(set (match_operand: 0 "register_operand" "=Yk") (unspec: - [(match_operand:VI48_512 1 "register_operand" "v") - (match_operand:VI48_512 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))] + [(match_operand:VI48_AVX512VL 1 "register_operand" "v") + (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))] "TARGET_AVX512F" "vpcmpgt\t{%2, %1, %0|%0, %1, %2}" [(set_attr "type" "ssecmp") @@ -10260,6 +10296,18 @@ (set_attr "prefix" "evex") (set_attr "mode" "")]) +(define_insn "_gt3" + [(set (match_operand: 0 "register_operand" "=Yk") + (unspec: + [(match_operand:VI12_AVX512VL 1 "register_operand" "v") + (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))] + "TARGET_AVX512BW" + "vpcmpgt\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "type" "ssecmp") + (set_attr "prefix_extra" "1") + (set_attr "prefix" "evex") + (set_attr "mode" "")]) + (define_insn "sse2_gt3" [(set (match_operand:VI124_128 0 "register_operand" "=x,x") (gt:VI124_128 @@ -10653,22 +10701,44 @@ ] (const_string "")))]) -(define_insn "avx512f_testm3" +(define_insn "_testm3" [(set (match_operand: 0 "register_operand" "=Yk") (unspec: - [(match_operand:VI48_512 1 "register_operand" "v") - (match_operand:VI48_512 2 "nonimmediate_operand" "vm")] + [(match_operand:VI12_AVX512VL 1 "register_operand" "v") + (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] + UNSPEC_TESTM))] + "TARGET_AVX512BW" + "vptestm\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "prefix" "evex") + (set_attr "mode" "")]) + +(define_insn "_testm3" + [(set (match_operand: 0 "register_operand" "=Yk") + (unspec: + [(match_operand:VI48_AVX512VL 1 "register_operand" "v") + (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_TESTM))] "TARGET_AVX512F" "vptestm\t{%2, %1, %0|%0, %1, %2}" [(set_attr "prefix" "evex") (set_attr "mode" "")]) -(define_insn "avx512f_testnm3" +(define_insn "_testnm3" + [(set (match_operand: 0 "register_operand" "=Yk") + (unspec: + [(match_operand:VI12_AVX512VL 1 "register_operand" "v") + (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] + UNSPEC_TESTNM))] + "TARGET_AVX512BW" + "vptestnm\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "prefix" "evex") + (set_attr "mode" "")]) + +(define_insn "_testnm3" [(set (match_operand: 0 "register_operand" "=Yk") (unspec: - [(match_operand:VI48_512 1 "register_operand" "v") - (match_operand:VI48_512 2 "nonimmediate_operand" "vm")] + [(match_operand:VI48_AVX512VL 1 "register_operand" "v") + (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_TESTNM))] "TARGET_AVX512F" "vptestnm\t{%2, %1, %0|%0, %1, %2}" -- 2.30.2