* Question about constructing vector types in GIMPLE pass
@ 2024-04-08 13:18 Hanke Zhang
2024-04-08 19:01 ` Marc Glisse
0 siblings, 1 reply; 4+ messages in thread
From: Hanke Zhang @ 2024-04-08 13:18 UTC (permalink / raw)
To: GCC Development
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 some
vector types in the GIMPLE code are confusing to me. The example code
is here:
_1 = 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! :)
Thanks
Hanke Zhang
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about constructing vector types in GIMPLE pass
2024-04-08 13:18 Question about constructing vector types in GIMPLE pass Hanke Zhang
@ 2024-04-08 19:01 ` Marc Glisse
2024-04-09 2:40 ` Hanke Zhang
0 siblings, 1 reply; 4+ messages in thread
From: Marc Glisse @ 2024-04-08 19:01 UTC (permalink / raw)
To: Hanke Zhang; +Cc: GCC Development
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 some
> vector types in the GIMPLE code are confusing to me. The example code
> is here:
>
> _1 = 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 to
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 have
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about constructing vector types in GIMPLE pass
2024-04-08 19:01 ` Marc Glisse
@ 2024-04-09 2:40 ` Hanke Zhang
2024-04-09 6:58 ` Richard Biener
0 siblings, 1 reply; 4+ messages in thread
From: Hanke Zhang @ 2024-04-09 2:40 UTC (permalink / raw)
To: GCC Development
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 = build_vector_type_for_mode (intDI_type_node, V4DImode);
tree type_p = 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. :)
Thanks
Hanke Zhang
Marc Glisse <marc.glisse@inria.fr> 于2024年4月9日周二 03:01写道:
>
> 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 some
> > vector types in the GIMPLE code are confusing to me. The example code
> > is here:
> >
> > _1 = 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 to
> 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 have
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about constructing vector types in GIMPLE pass
2024-04-09 2:40 ` Hanke Zhang
@ 2024-04-09 6:58 ` Richard Biener
0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2024-04-09 6:58 UTC (permalink / raw)
To: Hanke Zhang; +Cc: GCC Development
On Tue, Apr 9, 2024 at 4:42 AM Hanke Zhang via Gcc <gcc@gcc.gnu.org> 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 = build_vector_type_for_mode (intDI_type_node, V4DImode);
> tree type_p = 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 operand
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 <marc.glisse@inria.fr> 于2024年4月9日周二 03:01写道:
> >
> > 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 some
> > > vector types in the GIMPLE code are confusing to me. The example code
> > > is here:
> > >
> > > _1 = 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 to
> > 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 have
> > 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-09 6:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 13:18 Question about constructing vector types in GIMPLE pass Hanke Zhang
2024-04-08 19:01 ` Marc Glisse
2024-04-09 2:40 ` Hanke Zhang
2024-04-09 6:58 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).