From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by sourceware.org (Postfix) with ESMTPS id 570FB3858CDA for ; Sun, 31 Jul 2022 17:00:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 570FB3858CDA Received: by mail-qv1-xf2a.google.com with SMTP id i4so6901821qvv.7 for ; Sun, 31 Jul 2022 10:00:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=FZQs25b+t4hSXETbQH/6d58FUQRIslQ0p843TrILFek=; b=R5ofxEdmilG2d73BTbgUDS8AoCyRC/9SNiPS2o65qITcfMxeDPEGpShLZLZ4zT5Z8o RQa4F3yKicquH7XLRmMAwHWR5N6shUj0NYMdD3pkKqzuenb1kJC2MrVb+sXaV+mhAnyd EcWkP2Ze0PXj4W3l5Fzl02TA5bkrAzDBXyuy262BjCsfjLKseWKAK4hOaEgl+3ZckRBT nV5j5yUDgKNAuyfoBKRaFIJM+O3u5y/3GQvr2X30wya/A7WsX8L9TuZWa8pvP8Xz33fu xGdHZl/1D2qGIx+n86G+IArPmNS1HRMRXDrEtKhrQuOUoTyw+8sRxFkTYqcXLlSlQtv2 RbXw== X-Gm-Message-State: ACgBeo2JYhCvCAYvQ+iErdOUPVzAUxLh2YdBxceT3hO0IJJPjssE5Vjv Eley6ML90oJ2fwTHMIRZx3llO9NkMihVOt8KxD8sJpSwmo54Lw== X-Google-Smtp-Source: AA6agR6v0aFEAPJK9Gwj5jpSMacs09VTtTH2RW71DIekg8xZTawq11FFpL/TUdie7tDr3jIp6reE5WmNj1xC0T5h4tU= X-Received: by 2002:a05:6214:4119:b0:474:877b:8bac with SMTP id kc25-20020a056214411900b00474877b8bacmr11150782qvb.1.1659286849355; Sun, 31 Jul 2022 10:00:49 -0700 (PDT) MIME-Version: 1.0 References: <20220630145016.126279-1-hjl.tools@gmail.com> In-Reply-To: From: Uros Bizjak Date: Sun, 31 Jul 2022 19:00:38 +0200 Message-ID: Subject: Re: [GCC 12] [PATCH] x86: Support 2/4/8 byte constant vector stores To: "H.J. Lu" Cc: Richard Biener , "gcc-patches@gcc.gnu.org" , Noah Goldstein , Hongtao Liu Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: Sun, 31 Jul 2022 17:00:55 -0000 On Wed, Jul 27, 2022 at 4:24 PM H.J. Lu wrote: > > On Fri, Jul 1, 2022 at 8:31 AM Uros Bizjak wrote: > > > > On Thu, Jun 30, 2022 at 4:50 PM H.J. Lu wrote: > > > > > > 1. Add a predicate for constant vectors which can be converted to integer > > > constants suitable for constant integer stores. For a 8-byte constant > > > vector, the converted 64-bit integer must be valid for store with 64-bit > > > immediate, which is a 64-bit integer sign-extended from a 32-bit integer. > > > 2. Add a new pattern to allow 2-byte, 4-byte and 8-byte constant vector > > > stores, like > > > > > > (set (mem:V2HI (reg:DI 84)) > > > (const_vector:V2HI [(const_int 0 [0]) (const_int 1 [0x1])])) > > > > > > 3. After reload, convert constant vector stores to constant integer > > > stores, like > > > > > > (set (mem:SI (reg:DI 5 di [84])) > > > (const_int 65536 [0x10000])) > > > > > > For > > > > > > void > > > foo (short * c) > > > { > > > c[0] = 0; > > > c[1] = 1; > > > } > > > > > > it generates > > > > > > movl $65536, (%rdi) > > > > > > instead of > > > > > > movl .LC0(%rip), %eax > > > movl %eax, (%rdi) > > > > > > gcc/ > > > > > > PR target/106022 > > > * config/i386/i386-protos.h (ix86_convert_const_vector_to_integer): > > > New. > > > * config/i386/i386.cc (ix86_convert_const_vector_to_integer): > > > New. > > > * config/i386/mmx.md (V_16_32_64): New. > > > (*mov_imm): New patterns for stores with 16-bit, 32-bit > > > and 64-bit constant vector. > > > * config/i386/predicates.md (x86_64_const_vector_operand): New. > > > > > > gcc/testsuite/ > > > > > > PR target/106022 > > > * gcc.target/i386/pr106022-1.c: New test. > > > * gcc.target/i386/pr106022-2.c: Likewise. > > > * gcc.target/i386/pr106022-3.c: Likewise. > > > * gcc.target/i386/pr106022-4.c: Likewise. > > > > OK. > > OK to backport to GCC 12 branch? Lets keep this in mainline only. It isn't something that makes a lot of difference. Uros.