diff options
author | Andreas Krebbel <krebbel@linux.ibm.com> | 2024-04-23 10:05:46 +0200 |
---|---|---|
committer | Andreas Krebbel <krebbel@linux.ibm.com> | 2024-04-23 10:05:56 +0200 |
commit | 42189f21b22c43ac8ab46edf5f6a7b4d99bc86a5 (patch) | |
tree | f4bc379161e2d6f81c7d6e77a95449775ecfebbc /gcc/config/s390 | |
parent | aa73eb97a1e3c84564fa71158d09f9c5582c4d2e (diff) | |
download | gcc-42189f21b22c43ac8ab46edf5f6a7b4d99bc86a5.zip gcc-42189f21b22c43ac8ab46edf5f6a7b4d99bc86a5.tar.gz gcc-42189f21b22c43ac8ab46edf5f6a7b4d99bc86a5.tar.bz2 |
s390x: Fix vec_xl/vec_xst type aliasing [PR114676]
The requirements of the vec_xl/vec_xst intrinsincs wrt aliasing of the
pointer argument are not really documented. As it turns out, users
are likely to get it wrong. With this patch we let the pointer
argument alias everything in order to make it more robust for users.
gcc/ChangeLog:
PR target/114676
* config/s390/s390-c.cc (s390_expand_overloaded_builtin): Use a
MEM_REF with an addend of type ptr_type_node.
gcc/testsuite/ChangeLog:
PR target/114676
* gcc.target/s390/zvector/pr114676.c: New test.
Suggested-by: Jakub Jelinek <jakub@redhat.com>
Diffstat (limited to 'gcc/config/s390')
-rw-r--r-- | gcc/config/s390/s390-c.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc index 8d3d1a4..1bb6e81 100644 --- a/gcc/config/s390/s390-c.cc +++ b/gcc/config/s390/s390-c.cc @@ -498,11 +498,11 @@ s390_expand_overloaded_builtin (location_t loc, /* 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)); + build_int_cst (ptr_type_node, 0)); } case S390_OVERLOADED_BUILTIN_s390_vec_xst: case S390_OVERLOADED_BUILTIN_s390_vec_xstd2: @@ -511,11 +511,13 @@ s390_expand_overloaded_builtin (location_t loc, /* 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 (ptr_type_node, 0)), (*arglist)[0]); } case S390_OVERLOADED_BUILTIN_s390_vec_load_pair: |