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.gli...@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