From: Haochen Jiang Date: Thu, 2 Dec 2021 07:30:17 +0000 (+0800) Subject: Add combine splitter to transform vpternlogd/vpcmpeqd/vpxor/vblendvps to vblendvps... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=456b53654a3e3cc550c24f2cb0e37e7fdfadf68e;p=test_jj.git Add combine splitter to transform vpternlogd/vpcmpeqd/vpxor/vblendvps to vblendvps for ~op0 gcc/ChangeLog: PR target/100738 * config/i386/sse.md (*avx_cmp3_lt, *avx_cmp3_ltint): Remove MEM_P restriction and add force_reg for operands[2]. (*avx_cmp3_ltint_not): Add new define_insn_and_split. gcc/testsuite/ChangeLog: PR target/100738 * g++.target/i386/avx512vl-pr100738-1.C: New test. --- diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 768a93e..97ce5b3 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -3525,8 +3525,7 @@ UNSPEC_PCMP)))] "TARGET_AVX512VL && ix86_pre_reload_split () /* LT or GE 0 */ - && ((INTVAL (operands[5]) == 1 && !MEM_P (operands[2])) - || (INTVAL (operands[5]) == 5 && !MEM_P (operands[1])))" + && ((INTVAL (operands[5]) == 1) || (INTVAL (operands[5]) == 5))" "#" "&& 1" [(set (match_dup 0) @@ -3540,6 +3539,7 @@ { if (INTVAL (operands[5]) == 5) std::swap (operands[1], operands[2]); + operands[2] = force_reg (mode, operands[2]); }) (define_insn_and_split "*avx_cmp3_ltint" @@ -3554,8 +3554,7 @@ UNSPEC_PCMP)))] "TARGET_AVX512VL && ix86_pre_reload_split () /* LT or GE 0 */ - && ((INTVAL (operands[5]) == 1 && !MEM_P (operands[2])) - || (INTVAL (operands[5]) == 5 && !MEM_P (operands[1])))" + && ((INTVAL (operands[5]) == 1) || (INTVAL (operands[5]) == 5))" "#" "&& 1" [(set (match_dup 0) @@ -3572,7 +3571,44 @@ std::swap (operands[1], operands[2]); operands[0] = gen_lowpart (mode, operands[0]); operands[1] = gen_lowpart (mode, operands[1]); + operands[2] = force_reg (mode, + gen_lowpart (mode, operands[2])); +}) + +(define_insn_and_split "*avx_cmp3_ltint_not" + [(set (match_operand:VI48_AVX 0 "register_operand") + (vec_merge:VI48_AVX + (match_operand:VI48_AVX 1 "vector_operand") + (match_operand:VI48_AVX 2 "vector_operand") + (unspec: + [(subreg:VI48_AVX + (not: + (match_operand: 3 "vector_operand")) 0) + (match_operand:VI48_AVX 4 "const0_operand") + (match_operand:SI 5 "const_0_to_7_operand")] + UNSPEC_PCMP)))] + "TARGET_AVX512VL && ix86_pre_reload_split () + /* not LT or GE 0 */ + && ((INTVAL (operands[5]) == 1) || (INTVAL (operands[5]) == 5))" + "#" + "&& 1" + [(set (match_dup 0) + (unspec: + [(match_dup 1) + (match_dup 2) + (subreg: + (lt:VI48_AVX + (match_dup 3) + (match_dup 4)) 0)] + UNSPEC_BLENDV))] +{ + if (INTVAL (operands[5]) == 5) + std::swap (operands[1], operands[2]); + operands[0] = gen_lowpart (mode, operands[0]); + operands[1] = force_reg (mode, + gen_lowpart (mode, operands[1])); operands[2] = gen_lowpart (mode, operands[2]); + operands[3] = lowpart_subreg (mode, operands[3], mode); }) (define_insn "avx_vmcmp3" diff --git a/gcc/testsuite/g++.target/i386/avx512vl-pr100738-1.C b/gcc/testsuite/g++.target/i386/avx512vl-pr100738-1.C new file mode 100755 index 0000000..ac4d62b --- /dev/null +++ b/gcc/testsuite/g++.target/i386/avx512vl-pr100738-1.C @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast -march=cascadelake" } */ +/* { dg-final {scan-assembler-times "vblendvps\[ \\t\]" 2 } } */ +/* { dg-final {scan-assembler-not "vpcmpeqd\[ \\t\]" } } */ +/* { dg-final {scan-assembler-not "vpxor\[ \\t\]" } } */ +/* { dg-final {scan-assembler-not "vpternlogd\[ \\t\]" } } */ + +#include "pr100738-1.C"