From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id EB7DD3858CD1 for ; Tue, 9 Apr 2024 06:58:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB7DD3858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EB7DD3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::134 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712645936; cv=none; b=C7TjzuOyhyvjUCc0Sd20fifh+vrBDuNVi78giixKb9dja4NCc9MWATB8wLQVLqrp8LGfG6Z6T/cqbP4VEx4NuBD68vQj/UnvsMSH7jYgvrQTbkIH8tphh766lZJo8ohd6h6V26os2gc53XDy6gINVg8/+fsdta36R9ueHiP9Hxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712645936; c=relaxed/simple; bh=X/ItANiB6vWbwQpFgORk3zU/jrSKuJ1onL9cEkiVRP4=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=NhOhVlww3Q106wBb/3e9cKaf8ulT82BN+w+UzHPJm8xjRSoo7+doOFzxzVX5ofIhuARMWDVpnluzf5haGyy+Fm+F8xoQ2594hbTIzNNP6HFFskV4gDFdVX6THltT0K/Batj83KAaMZ31h0e7Y9Y15sqVopMo3b5rQG9gQgS7ruo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-516d47ce662so6574083e87.1 for ; Mon, 08 Apr 2024 23:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712645932; x=1713250732; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uwlt1XZ56fEaJuza5MBdyq8zboEWEPr6jtlVycPcDuA=; b=ib4cDKbkyjNjDHpySkmJhoXyUq+MDKrRHH1tZ7Hc8y/NgEwGrWu5VNHqw+AONBdp7F a1LF1hiboWDaqTmqh9J3kaIFzzm0bNC9V3nfMnopfWI/55Bn48zPLYs6WvlpoWFgqeHY 4nbGBiZK1HkuN8MXyUK3D7BWK/jVsawK091l94tVbkZqRyuTQ76SARnJU8YpgOSHzoUL 051LpcxVVhPCSsyBCkLmiKaKcwrSnkH3yWPYGsOA+7yR0qdQEbEmJDyo2NedaCdjwSYs JheH4GZ92GNlnlgfFbOLYsq1O3P0cB+L4UdubHX2RW4avZjPcoYBVKqhFIlpVnlfwqCO 2TLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712645932; x=1713250732; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uwlt1XZ56fEaJuza5MBdyq8zboEWEPr6jtlVycPcDuA=; b=Jc3SyciVCCqeGctKdUqHIMtxjqoeva3mxoUeY2kpQOQ7yi12F5HsQgidU5bfRIty8i b9wJJ33M0i2dBML74ZBJ7xpJXIVAGnyBeObFkdOZny3tkSKi3CuXq6OT6pd3JDPW+wV3 KjHrpg7yXShQWUZlV5ONKS0hyAqUsVU8eCkpcQqTYBLLpSPnF87Bpd0SeFX7Vff/16dM Hycmaa3cZOUGcP2vWj4dLmzg9fS9KG2nvESIW6XBIZ5ncy12wIr02BQ+QZStPDilgeVY vY4bVqgQ9Tw3crc2yVUOMZXJzwb277bcNdaanBMjapQGJhEihVQcuy6Tmykfawjxcu2W vV7A== X-Gm-Message-State: AOJu0YyW96WTncvuDd9zDs2XPeoIFs9EcW3o74FM6NvwPrMhmfYVXI8j OPW5iKfhQbo8DbIKjc1hhukiKQTdwETusIgFu3w2mtH/6rzHIo0cBqONvBs152PgshLSoNNQ+s9 yJN2O3qpVG/Qx8rCik/uKSHZVGQJaUPs8Va4= X-Google-Smtp-Source: AGHT+IELxg9Kbsjnh1K9a4Bmvfx+XbvTpie/ixOpd7R5+5HHXMmYGx0BMI49EZh1y4MBG8K5Crqi/kT0dDAcJH7Aaxw= X-Received: by 2002:a05:6512:3b89:b0:515:b93d:c885 with SMTP id g9-20020a0565123b8900b00515b93dc885mr11926018lfv.23.1712645932076; Mon, 08 Apr 2024 23:58:52 -0700 (PDT) MIME-Version: 1.0 References: <3e8f4655-1d0a-2de4-9520-5e6a4fddc2b9@inria.fr> In-Reply-To: From: Richard Biener Date: Tue, 9 Apr 2024 08:58:41 +0200 Message-ID: Subject: Re: Question about constructing vector types in GIMPLE pass To: Hanke Zhang Cc: GCC Development Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 List-Id: On Tue, Apr 9, 2024 at 4:42=E2=80=AFAM Hanke Zhang via Gcc wrote: > > Hi Marc, > > Thanks for your reply. > > I want to create a new type similar to this one `(const __m256i_u * > {ref-all})` indeed. And I try to create it via these calls: > > tree type =3D build_vector_type_for_mode (intDI_type_node, V4DImode); > tree type_p =3D build_pointer_type_for_mode(type, VOIDmode, true); > > But when I print the `type_p`, it shows `vector(4) long int * > {ref-all}`. So I'm confused if they are the same type or can be > transferred to each other. > > And I'm stucked with another problem that, I want to call > `__builtin_ia32_pmovmskb256` in the GIMPLE pass. But I found that this > function is defined in `config/i386/i386-builtins.h`. And when I try > to include this header file, the error will occur during the > compilation. If you know any way to solve this problem, I would be > very grateful. :) The type being dumped in the "cast" is the type of the constant offset oper= and which is used to determine the type effective for TBAA. I'll suggest you use -fdump-tree-XXX-gimple which dumps the MEM_REFs in a more complete way (yeah, should make that default ... but need to adjust all testcases that scan for them). You can't call __builtin_ia32_pmovmskb256, you instead should emit .MASK_LOAD or .MASK_STORE internal function calls. Richard. > Thanks > Hanke Zhang > > Marc Glisse =E4=BA=8E2024=E5=B9=B44=E6=9C=889=E6= =97=A5=E5=91=A8=E4=BA=8C 03:01=E5=86=99=E9=81=93=EF=BC=9A > > > > On Mon, 8 Apr 2024, Hanke Zhang via Gcc wrote: > > > > > Hi, > > > I've been working on strengthening auto-vectorization on intel CPUs > > > recently. I tried to do it in the GIMPLE pass. And I noticed that som= e > > > vector types in the GIMPLE code are confusing to me. The example code > > > is here: > > > > > > _1 =3D MEM[(const __m256i_u * {ref-all})_2]; > > > > > > I wondered how I could construct or get the type `(const __m256i_u * > > > {ref-all})` in the GIMPLE pass. > > > > > > If you have any ideas that can help me. I'll be so grateful! :) > > > > I am not sure what you are asking exactly. If you already have access t= o > > such a MEM_REF, then the doc tells you where to look for this type: > > > > "The first operand is the pointer being dereferenced; it will always ha= ve > > pointer or reference type. The second operand is a pointer constant > > serving as constant offset applied to the pointer being dereferenced > > with its type specifying the type to be used for type-based alias > > analysis. > > The type of the node specifies the alignment of the access." > > > > If you want to create a new type similar to this one, you can build it > > with various tools: > > > > build_vector_type or build_vector_type_for_mode > > build_pointer_type_for_mode(*, VOIDmode, true) to build a pointer that = can alias anything > > build_qualified_type to add const (probably useless) > > build_aligned_type to specify that it is unaligned > > > > -- > > Marc Glisse