[Bug target/18916] [4.0 Regression] mis-aligned vector code with copy memory (-maltivec)

fjahanian at apple dot com gcc-bugzilla@gcc.gnu.org
Sat Dec 18 01:46:00 GMT 2004


------- Additional Comments From fjahanian at apple dot com  2004-12-18 01:46 -------
And this is the patch that I had in mind. Can this break ABI compatibily? My limited testing shows
that it does not.

Index: rs6000.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.332.2.46.2.84
diff -c -p -r1.332.2.46.2.84 rs6000.c
*** rs6000.c    16 Dec 2004 03:23:30 -0000      1.332.2.46.2.84
--- rs6000.c    18 Dec 2004 01:44:28 -0000
*************** function_arg_boundary (enum machine_mode
*** 5190,5195 ****
--- 5190,5201 ----
           || (type && TREE_CODE (type) == VECTOR_TYPE
               && int_size_in_bytes (type) >= 16))
      return 128;
+   else if (DEFAULT_ABI == ABI_DARWIN && mode == BLKmode
+          && TYPE_ALIGN (type) >= 128)
+     {
+       TYPE_ALIGN (type) = PARM_BOUNDARY;
+       return PARM_BOUNDARY;
+     }
    else
      return PARM_BOUNDARY;
  }

(In reply to comment #5)
> Followin patch fixes the alignment problem. But it cannot be applied because it breaks ABI
> compatibilty. 
> 
> A possible solution is to relax alignment of the type in question (with alignment of 128) to that of the
> PARM_BOUNDARY (32). This will not (should not ?) break the ABI compatibility (because it is currently 
> on PARM_BOUNDARY). But it will prevent vector code to be generated (which is cause of the abort).
> Comments are most welcome.
> 
> 
> Index: rs6000.c
> 
===============================================================
> ====
> RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
> retrieving revision 1.332.2.46.2.84
> diff -c -p -r1.332.2.46.2.84 rs6000.c
> *** rs6000.c    16 Dec 2004 03:23:30 -0000      1.332.2.46.2.84
> --- rs6000.c    18 Dec 2004 00:20:54 -0000
> *************** function_arg_boundary (enum machine_mode
> *** 5190,5195 ****
> --- 5190,5197 ----
>            || (type && TREE_CODE (type) == VECTOR_TYPE
>                && int_size_in_bytes (type) >= 16))
>       return 128;
> +   else if (DEFAULT_ABI == ABI_DARWIN && mode == BLKmode)
> +     return MAX (TYPE_ALIGN (type), PARM_BOUNDARY);
>     else
>       return PARM_BOUNDARY;
>   }



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18916



More information about the Gcc-bugs mailing list