if (TARGET_VSX && TARGET_ALLOW_MOVMISALIGN)
{
elements = TYPE_VECTOR_SUBPARTS (vectype);
- if (elements == 2)
+ /* See PR102767, consider V1TI to keep consistency. */
+ if (elements == 2 || elements == 1)
/* Double word aligned. */
return 4;
if (TARGET_EFFICIENT_UNALIGNED_VSX)
return 1;
- if (TARGET_VSX && TARGET_ALLOW_MOVMISALIGN)
- {
- elements = TYPE_VECTOR_SUBPARTS (vectype);
- if (elements == 2)
- /* Double word aligned. */
- return 2;
+ if (TARGET_VSX && TARGET_ALLOW_MOVMISALIGN)
+ {
+ elements = TYPE_VECTOR_SUBPARTS (vectype);
+ /* See PR102767, consider V1TI to keep consistency. */
+ if (elements == 2 || elements == 1)
+ /* Double word aligned. */
+ return 2;
- if (elements == 4)
- {
- switch (misalign)
- {
- case 8:
- /* Double word aligned. */
- return 2;
-
- case -1:
- /* Unknown misalignment. */
- case 4:
- case 12:
- /* Word aligned. */
- return 23;
-
- default:
- gcc_unreachable ();
- }
- }
- }
+ if (elements == 4)
+ {
+ switch (misalign)
+ {
+ case 8:
+ /* Double word aligned. */
+ return 2;
- if (TARGET_ALTIVEC)
- /* Misaligned stores are not supported. */
- gcc_unreachable ();
+ case -1:
+ /* Unknown misalignment. */
+ case 4:
+ case 12:
+ /* Word aligned. */
+ return 23;
- return 2;
+ default:
+ gcc_unreachable ();
+ }
+ }
+ }
+
+ if (TARGET_ALTIVEC)
+ /* Misaligned stores are not supported. */
+ gcc_unreachable ();
+
+ return 2;
case vec_construct:
/* This is a rough approximation assuming non-constant elements
--- /dev/null
+! { dg-require-effective-target powerpc_vsx_ok }
+! { dg-options "-mvsx -O2 -ftree-vectorize -mno-efficient-unaligned-vsx" }
+
+INTERFACE
+ FUNCTION elemental_mult (a, b, c)
+ type(*), DIMENSION(..) :: a, b, c
+ END
+END INTERFACE
+
+allocatable z
+integer, dimension(2,2) :: a, b
+call test_CFI_address
+contains
+ subroutine test_CFI_address
+ if (elemental_mult (z, x, y) .ne. 0) stop
+ a = reshape ([4,3,2,1], [2,2])
+ b = reshape ([2,3,4,5], [2,2])
+ if (elemental_mult (i, a, b) .ne. 0) stop
+ end
+end
+