https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114676

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It depends on what the vec_xl*/vec_xst* documentation requires/user expect.
If the expectation is that the loads/stores should alias the scalar pointee of
the pointer type passed to those intrinsics, then
--- gcc/config/s390/s390-c.cc.jj        2024-01-03 11:51:54.847407588 +0100
+++ gcc/config/s390/s390-c.cc   2024-04-10 16:30:31.896197832 +0200
@@ -498,8 +498,8 @@ s390_expand_overloaded_builtin (location
        /* Build a vector type with the alignment of the source
           location in order to enable correct alignment hints to be
           generated for vl.  */
-       tree mem_type = build_aligned_type (return_type,
-                                           TYPE_ALIGN (TREE_TYPE (TREE_TYPE
((*arglist)[1]))));
+       unsigned align = TYPE_ALIGN (TREE_TYPE (TREE_TYPE ((*arglist)[1])));
+       tree mem_type = build_aligned_type (return_type, align);
        return build2 (MEM_REF, mem_type,
                       fold_build_pointer_plus ((*arglist)[1], (*arglist)[0]),
                       build_int_cst (TREE_TYPE ((*arglist)[1]), 0));
@@ -511,11 +511,13 @@ s390_expand_overloaded_builtin (location
        /* Build a vector type with the alignment of the target
           location in order to enable correct alignment hints to be
           generated for vst.  */
-       tree mem_type = build_aligned_type (TREE_TYPE((*arglist)[0]),
-                                           TYPE_ALIGN (TREE_TYPE (TREE_TYPE
((*arglist)[2]))));
+       unsigned align = TYPE_ALIGN (TREE_TYPE (TREE_TYPE ((*arglist)[2])));
+       tree mem_type = build_aligned_type (TREE_TYPE ((*arglist)[0]), align);
        return build2 (MODIFY_EXPR, mem_type,
-                      build1 (INDIRECT_REF, mem_type,
-                              fold_build_pointer_plus ((*arglist)[2],
(*arglist)[1])),
+                      build2 (MEM_REF, mem_type,
+                              fold_build_pointer_plus ((*arglist)[2],
+                                                       (*arglist)[1]),
+                              build_int_cst (TREE_TYPE ((*arglist)[2]), 0)),
                       (*arglist)[0]);
       }
     case S390_OVERLOADED_BUILTIN_s390_vec_load_pair:
might be all that is needed (if it is needed at all).
If the expectation is that one can read what has been written by those
intrinsics or write
what will be read by those intrinsics though unrelated effective pointers, then
it should alias everything,
which could be say just using ptr_type_node instead of the current types in
both of the build_int_cst (..., 0) calls above.

Reply via email to