From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) by sourceware.org (Postfix) with ESMTPS id 131ED382B5DA for ; Fri, 27 May 2022 09:05:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 131ED382B5DA Received: by mail-qv1-xf2c.google.com with SMTP id r1so3230869qvz.8 for ; Fri, 27 May 2022 02:05:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8ODwkwpl/DAb5Uuh/U5fMZIKS2ABlODVN73dQs5PUAw=; b=1OQDMY1bDZNYP7/zHQKZdGAntY4Er49MITj0OE+868VoTH1v22/7UNdpaQoTihLjru sOuOp7lETewaNIWtJD1I5hi+quBa6mESLbaT5koNYS80hapgqeyXsnWQZBGFE7e/WSWn OohoHK4kNpGkwGtP08jFYa3ZYbRinR898FM6RJolY/r38TbC8W8+VJYAeD3u6olLf0L9 qA8rC3HrX2mYygxrMnKT3D5PNFOD7jvFRVprgXf3jarw++n79jrZyfAdkYRE0gDW906p +Rj7haQ0lTqa9qwQWBMisVTsxgQb+1Duc/SIiW1JJRZ2peNZfNeuucxcOIG5jeOqaUsY 0YDA== X-Gm-Message-State: AOAM530CtjuQq7vsvRAOM5U+NX1+/Gyg3hbqfS1Y172H22SN5OEd6YoH d8RLNoEtFd4ioqyUEacC5gboUVcFdydeuuIDgck= X-Google-Smtp-Source: ABdhPJz621JnvMMPjRiHhXyB3GJU+1KuwkRhM8NKhP17LMt7mUQ1ayGXakgebRKoby4jLB4L5z70g08DklSS+IqGpH4= X-Received: by 2002:a0c:fd6b:0:b0:462:5f5f:9ef with SMTP id k11-20020a0cfd6b000000b004625f5f09efmr12634918qvs.48.1653642314404; Fri, 27 May 2022 02:05:14 -0700 (PDT) MIME-Version: 1.0 References: <20d007c8-f703-8fac-6a13-1643af31adc6@suse.com> In-Reply-To: <20d007c8-f703-8fac-6a13-1643af31adc6@suse.com> From: Uros Bizjak Date: Fri, 27 May 2022 11:05:03 +0200 Message-ID: Subject: Re: [PATCH] x86: {,v}psadbw have commutative source operands To: Jan Beulich Cc: "gcc-patches@gcc.gnu.org" , "hubicka@ucw.cz" , Kirill Yukhin , Hongtao Liu Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Fri, 27 May 2022 09:05:16 -0000 On Fri, May 27, 2022 at 10:13 AM Jan Beulich wrote: > > Like noticed for gas as well (binutils-gdb commit c8cad9d389b7), the > "absolute difference" aspect of the insns makes their source operands > commutative. You will need to expand via ix86_fixup_binary_operands_no_copy, use register_mmxmem_operand on both input operands and use ix86_binary_operator insn constraint. Please see many examples w/ commutative operands throughout .md files. Uros. > gcc/ > 2022-05-XX Jan Beulich > > * config/i386/mmx.md (mmx_psadbw): Mark as commutative. > * config/i386/sse.md (_psadbw): Likewise. > > --- a/gcc/config/i386/mmx.md > +++ b/gcc/config/i386/mmx.md > @@ -4407,7 +4407,7 @@ > > (define_insn "mmx_psadbw" > [(set (match_operand:V1DI 0 "register_operand" "=y,x,Yw") > - (unspec:V1DI [(match_operand:V8QI 1 "register_operand" "0,0,Yw") > + (unspec:V1DI [(match_operand:V8QI 1 "register_operand" "%0,0,Yw") > (match_operand:V8QI 2 "register_mmxmem_operand" "ym,x,Yw")] > UNSPEC_PSADBW))] > "(TARGET_MMX || TARGET_MMX_WITH_SSE) > --- a/gcc/config/i386/sse.md > +++ b/gcc/config/i386/sse.md > @@ -19983,7 +19983,7 @@ > (define_insn "_psadbw" > [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,YW") > (unspec:VI8_AVX2_AVX512BW > - [(match_operand: 1 "register_operand" "0,YW") > + [(match_operand: 1 "register_operand" "%0,YW") > (match_operand: 2 "vector_operand" "xBm,YWm")] > UNSPEC_PSADBW))] > "TARGET_SSE2" >