From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by sourceware.org (Postfix) with ESMTPS id F08CD385DC2B for ; Sat, 4 Apr 2020 22:03:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F08CD385DC2B Received: by mail-il1-x143.google.com with SMTP id x16so11059912ilp.12 for ; Sat, 04 Apr 2020 15:03:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=j3G/2cGxDaFd7m4TaDUB2+8ZnZq3x1fOjGSUqvWvCWc=; b=pKSjZ4/0ay+1xLbTi5K0YL5lXxjmtYzm2IXwmkZQbXrP0B8xfaE1W9khEYeQBnYXuf Gl6kX561CIXBXPGYJEcpPj/HNR2f+OTOm9WUXbaVG6xYij8uxraLLJGxRcmZLnR5MaLH 5ZRO5HnAhQ6P4nolz9O3bWZogWliYdXI0wWgxFYGJdfhKrXRCqwPvCHvfJjr5NmxBTju PBGix2eDwniBRxGhKSOa7f/UkDdOm6Lt5Mcfe3ehTrygyCm7jUfCjsINOap9Eeb9wJtj MJ+/GhwxkLSTEgZiRBHbDzfX1JBH2P0lSqMOAImRCBPO43wbFlp2sDOIfL9nNboj03dV i9sw== X-Gm-Message-State: AGi0PuaNp1vijlhCcurGKSR2BodNzobWDiDLYKYGJFbifzZGnIy8oKNe JbVgJj/tT3NI/AM9TV7RdUlpN8VNn0Od8jw+gws= X-Google-Smtp-Source: APiQypKbaJ51x8yDN0rV01TNisb+6fo/nNP3kRZR7sYZGq11I7sfG9k10idrpasM8kKaK2gic6igmYMBwcw6PrnQ+kk= X-Received: by 2002:a92:8f53:: with SMTP id j80mr15372013ild.171.1586037828317; Sat, 04 Apr 2020 15:03:48 -0700 (PDT) MIME-Version: 1.0 References: <20200403224132.GI2212@tucnak> In-Reply-To: <20200403224132.GI2212@tucnak> From: Uros Bizjak Date: Sun, 5 Apr 2020 00:03:37 +0200 Message-ID: Subject: Re: [PATCH] i386: Simplify {, v}ph{add, sub{, s}{w, d} insn patterns [PR94460] To: Jakub Jelinek Cc: "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Apr 2020 22:03:51 -0000 On Sat, Apr 4, 2020 at 12:41 AM Jakub Jelinek wrote: > > Hi! > > As mentioned in the previous PR94460 patch, the RTL patterns look too > large/complicated, we can simplify them by just performing two 2 arg > permutations to move the arguments into the right spots and then just > doing the plus/minus (or signed saturation version thereof). > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for stage1? > > 2020-04-04 Jakub Jelinek > > PR target/94460 > * config/i386/sse.md (avx2_phwv16hi3, > ssse3_phwv8hi3, ssse3_phwv4hi3, > avx2_phdv8si3, ssse3_phdv4si3, > ssse3_phdv2si3): Simplify RTL patterns. OK. Thanks, Uros. > --- gcc/config/i386/sse.md.jj 2020-04-03 10:21:51.110564277 +0200 > +++ gcc/config/i386/sse.md 2020-04-03 11:55:04.455963720 +0200 > @@ -16038,73 +16038,23 @@ (define_code_iterator ssse3_plusminus [p > > (define_insn "avx2_phwv16hi3" > [(set (match_operand:V16HI 0 "register_operand" "=x") > - (vec_concat:V16HI > - (vec_concat:V8HI > - (vec_concat:V4HI > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI > - (match_operand:V16HI 1 "register_operand" "x") > - (parallel [(const_int 0)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 2)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 3)])))) > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 4)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 5)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 6)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 7)]))))) > - (vec_concat:V4HI > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI > - (match_operand:V16HI 2 "nonimmediate_operand" "xm") > - (parallel [(const_int 0)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 1)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 2)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 3)])))) > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 4)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 5)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 6)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))) > - (vec_concat:V8HI > - (vec_concat:V4HI > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 8)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 9)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 10)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 11)])))) > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 12)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 13)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 14)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 15)]))))) > - (vec_concat:V4HI > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 8)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 9)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 10)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 11)])))) > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 12)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 13)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 14)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 15)]))))))))] > + (ssse3_plusminus:V16HI > + (vec_select:V16HI > + (vec_concat:V32HI > + (match_operand:V16HI 1 "register_operand" "x") > + (match_operand:V16HI 2 "nonimmediate_operand" "xm")) > + (parallel > + [(const_int 0) (const_int 2) (const_int 4) (const_int 6) > + (const_int 16) (const_int 18) (const_int 20) (const_int 22) > + (const_int 8) (const_int 10) (const_int 12) (const_int 14) > + (const_int 24) (const_int 26) (const_int 28) (const_int 30)])) > + (vec_select:V16HI > + (vec_concat:V32HI (match_dup 1) (match_dup 2)) > + (parallel > + [(const_int 1) (const_int 3) (const_int 5) (const_int 7) > + (const_int 17) (const_int 19) (const_int 21) (const_int 23) > + (const_int 9) (const_int 11) (const_int 13) (const_int 15) > + (const_int 25) (const_int 27) (const_int 29) (const_int 31)]))))] > "TARGET_AVX2" > "vphw\t{%2, %1, %0|%0, %1, %2}" > [(set_attr "type" "sseiadd") > @@ -16114,41 +16064,19 @@ (define_insn "avx2_ph > (define_insn "ssse3_phwv8hi3" > [(set (match_operand:V8HI 0 "register_operand" "=x,x") > - (vec_concat:V8HI > - (vec_concat:V4HI > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI > - (match_operand:V8HI 1 "register_operand" "0,x") > - (parallel [(const_int 0)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 2)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 3)])))) > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 4)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 5)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 6)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 7)]))))) > - (vec_concat:V4HI > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI > - (match_operand:V8HI 2 "vector_operand" "xBm,xm") > - (parallel [(const_int 0)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 1)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 2)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 3)])))) > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 4)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 5)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 6)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))))] > + (ssse3_plusminus:V8HI > + (vec_select:V8HI > + (vec_concat:V16HI > + (match_operand:V8HI 1 "register_operand" "0,x") > + (match_operand:V8HI 2 "vector_operand" "xBm,xm")) > + (parallel > + [(const_int 0) (const_int 2) (const_int 4) (const_int 6) > + (const_int 8) (const_int 10) (const_int 12) (const_int 14)])) > + (vec_select:V8HI > + (vec_concat:V16HI (match_dup 1) (match_dup 2)) > + (parallel > + [(const_int 1) (const_int 3) (const_int 5) (const_int 7) > + (const_int 9) (const_int 11) (const_int 13) (const_int 15)]))))] > "TARGET_SSSE3" > "@ > phw\t{%2, %0|%0, %2} > @@ -16163,25 +16091,17 @@ (define_insn "ssse3_ph > (define_insn_and_split "ssse3_phwv4hi3" > [(set (match_operand:V4HI 0 "register_operand" "=y,x,Yv") > - (vec_concat:V4HI > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI > - (match_operand:V4HI 1 "register_operand" "0,0,Yv") > - (parallel [(const_int 0)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 1)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 1) (parallel [(const_int 2)])) > - (vec_select:HI (match_dup 1) (parallel [(const_int 3)])))) > - (vec_concat:V2HI > - (ssse3_plusminus:HI > - (vec_select:HI > - (match_operand:V4HI 2 "register_mmxmem_operand" "ym,x,Yv") > - (parallel [(const_int 0)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 1)]))) > - (ssse3_plusminus:HI > - (vec_select:HI (match_dup 2) (parallel [(const_int 2)])) > - (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))))] > + (ssse3_plusminus:V4HI > + (vec_select:V4HI > + (vec_concat:V8HI > + (match_operand:V4HI 1 "register_operand" "0,0,Yv") > + (match_operand:V4HI 2 "register_mmxmem_operand" "ym,x,Yv")) > + (parallel > + [(const_int 0) (const_int 2) (const_int 4) (const_int 6)])) > + (vec_select:V4HI > + (vec_concat:V8HI (match_dup 1) (match_dup 2)) > + (parallel > + [(const_int 1) (const_int 3) (const_int 5) (const_int 7)]))))] > "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3" > "@ > phw\t{%2, %0|%0, %2} > @@ -16211,41 +16131,19 @@ (define_insn_and_split "ssse3_ph > (define_insn "avx2_phdv8si3" > [(set (match_operand:V8SI 0 "register_operand" "=x") > - (vec_concat:V8SI > - (vec_concat:V4SI > - (vec_concat:V2SI > - (plusminus:SI > - (vec_select:SI > - (match_operand:V8SI 1 "register_operand" "x") > - (parallel [(const_int 0)])) > - (vec_select:SI (match_dup 1) (parallel [(const_int 1)]))) > - (plusminus:SI > - (vec_select:SI (match_dup 1) (parallel [(const_int 2)])) > - (vec_select:SI (match_dup 1) (parallel [(const_int 3)])))) > - (vec_concat:V2SI > - (plusminus:SI > - (vec_select:SI > - (match_operand:V8SI 2 "nonimmediate_operand" "xm") > - (parallel [(const_int 0)])) > - (vec_select:SI (match_dup 2) (parallel [(const_int 1)]))) > - (plusminus:SI > - (vec_select:SI (match_dup 2) (parallel [(const_int 2)])) > - (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))) > - (vec_concat:V4SI > - (vec_concat:V2SI > - (plusminus:SI > - (vec_select:SI (match_dup 1) (parallel [(const_int 4)])) > - (vec_select:SI (match_dup 1) (parallel [(const_int 5)]))) > - (plusminus:SI > - (vec_select:SI (match_dup 1) (parallel [(const_int 6)])) > - (vec_select:SI (match_dup 1) (parallel [(const_int 7)])))) > - (vec_concat:V2SI > - (plusminus:SI > - (vec_select:SI (match_dup 2) (parallel [(const_int 4)])) > - (vec_select:SI (match_dup 2) (parallel [(const_int 5)]))) > - (plusminus:SI > - (vec_select:SI (match_dup 2) (parallel [(const_int 6)])) > - (vec_select:SI (match_dup 2) (parallel [(const_int 7)])))))))] > + (plusminus:V8SI > + (vec_select:V8SI > + (vec_concat:V16SI > + (match_operand:V8SI 1 "register_operand" "x") > + (match_operand:V8SI 2 "nonimmediate_operand" "xm")) > + (parallel > + [(const_int 0) (const_int 2) (const_int 8) (const_int 10) > + (const_int 4) (const_int 6) (const_int 12) (const_int 14)])) > + (vec_select:V8SI > + (vec_concat:V16SI (match_dup 1) (match_dup 2)) > + (parallel > + [(const_int 1) (const_int 3) (const_int 9) (const_int 11) > + (const_int 5) (const_int 7) (const_int 13) (const_int 15)]))))] > "TARGET_AVX2" > "vphd\t{%2, %1, %0|%0, %1, %2}" > [(set_attr "type" "sseiadd") > @@ -16255,25 +16153,17 @@ (define_insn "avx2_ph > (define_insn "ssse3_phdv4si3" > [(set (match_operand:V4SI 0 "register_operand" "=x,x") > - (vec_concat:V4SI > - (vec_concat:V2SI > - (plusminus:SI > - (vec_select:SI > - (match_operand:V4SI 1 "register_operand" "0,x") > - (parallel [(const_int 0)])) > - (vec_select:SI (match_dup 1) (parallel [(const_int 1)]))) > - (plusminus:SI > - (vec_select:SI (match_dup 1) (parallel [(const_int 2)])) > - (vec_select:SI (match_dup 1) (parallel [(const_int 3)])))) > - (vec_concat:V2SI > - (plusminus:SI > - (vec_select:SI > - (match_operand:V4SI 2 "vector_operand" "xBm,xm") > - (parallel [(const_int 0)])) > - (vec_select:SI (match_dup 2) (parallel [(const_int 1)]))) > - (plusminus:SI > - (vec_select:SI (match_dup 2) (parallel [(const_int 2)])) > - (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))))] > + (plusminus:V4SI > + (vec_select:V4SI > + (vec_concat:V8SI > + (match_operand:V4SI 1 "register_operand" "0,x") > + (match_operand:V4SI 2 "vector_operand" "xBm,xm")) > + (parallel > + [(const_int 0) (const_int 2) (const_int 4) (const_int 6)])) > + (vec_select:V4SI > + (vec_concat:V8SI (match_dup 1) (match_dup 2)) > + (parallel > + [(const_int 1) (const_int 3) (const_int 5) (const_int 7)]))))] > "TARGET_SSSE3" > "@ > phd\t{%2, %0|%0, %2} > @@ -16288,17 +16178,15 @@ (define_insn "ssse3_ph > (define_insn_and_split "ssse3_phdv2si3" > [(set (match_operand:V2SI 0 "register_operand" "=y,x,Yv") > - (vec_concat:V2SI > - (plusminus:SI > - (vec_select:SI > + (plusminus:V2SI > + (vec_select:V2SI > + (vec_concat:V4SI > (match_operand:V2SI 1 "register_operand" "0,0,Yv") > - (parallel [(const_int 0)])) > - (vec_select:SI (match_dup 1) (parallel [(const_int 1)]))) > - (plusminus:SI > - (vec_select:SI > - (match_operand:V2SI 2 "register_mmxmem_operand" "ym,x,Yv") > - (parallel [(const_int 0)])) > - (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))))] > + (match_operand:V2SI 2 "register_mmxmem_operand" "ym,x,Yv")) > + (parallel [(const_int 0) (const_int 2)])) > + (vec_select:V2SI > + (vec_concat:V4SI (match_dup 1) (match_dup 2)) > + (parallel [(const_int 1) (const_int 3)]))))] > "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3" > "@ > phd\t{%2, %0|%0, %2} > > Jakub >