This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PING^3 for PR target/17836, PR c/10735, PR c++/16882, PR rtl-optimization/17860[3.4]


>>>>> Fariborz Jahanian writes:

Fariborz> AltiVec ABI for APPLE-PPC-DARWIN is broken as shown in failure of 
Fariborz> darwin-abi-2.c test
Fariborz> in the deja-gnu test suite.  Attached  patch fixes the problem 
Fariborz> introduced by the recent changes.
Fariborz> Note that, in this patch I have only addressed the synthesized 16-byte 
Fariborz> vectors which in darwin
Fariborz> has the same ABI as an AltiVec vector. I tried, your patch and it made 
Fariborz> failure in darwin-abi-2.c worse.
Fariborz> My patch makes changes to additional routines, "function_arg_advance" 
Fariborz> and "function_arg". Please let
Fariborz> me know what you think.

	I do not understand how my patch made darwin-abi-2.c worse.  There
was a pre-existing runtime regression of darwin-abi-2.c on mainline.  My
patch committed Sunday changed that into a compile-time warning.  My patch
posted Monday morning returned that to a runtime failure.

	The darwin-abi-2.c runtime failure is due to rs6000 function_arg
now seeing Paolo's synthetic vectors when TARGET_ALTIVEC_ABI is enabled by
TARGET_ALTIVEC is not.  Your patch points out the problem but does not
solve it consistently with the idiom used in the rest of the file.

	The following patch fixes both the compile-time warning that my
version of Paolo's patch introduced and the runtime failure.  Please look
it over and see if you find any other problems.

Thanks, David

	* config/rs6000/rs6000.c (rs6000_return_in_memory): Test
	TARGET_ALTIVEC_ABI.
	(function_arg_boundary): Align 8 to 16 byte vectors like SPE.
	Align 16 byte and larger vectors like Altivec.
	(function_arg_advance): Pass any 16 byte vector like Altivec vector.
	(function_arg): Same.
	(rs6000_pass_by_references): Test TARGET_ALTIVEC_ABI.

Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.749
diff -c -p -r1.749 rs6000.c
*** rs6000.c	22 Nov 2004 14:56:06 -0000	1.749
--- rs6000.c	22 Nov 2004 19:54:58 -0000
*************** rs6000_return_in_memory (tree type, tree
*** 4643,4654 ****
  
    /* Return synthetic vectors in memory.  */
    if (TREE_CODE (type) == VECTOR_TYPE
!       && int_size_in_bytes (type) > (TARGET_ALTIVEC ? 16 : 8))
      {
        static bool warned_for_return_big_vectors = false;
        if (!warned_for_return_big_vectors)
  	{
! 	  warning ("synthetic vectors returned by reference: "
  		   "non-standard ABI extension with no compatibility guarantee");
  	  warned_for_return_big_vectors = true;
  	}
--- 4643,4654 ----
  
    /* Return synthetic vectors in memory.  */
    if (TREE_CODE (type) == VECTOR_TYPE
!       && int_size_in_bytes (type) > (TARGET_ALTIVEC_ABI ? 16 : 8))
      {
        static bool warned_for_return_big_vectors = false;
        if (!warned_for_return_big_vectors)
  	{
! 	  warning ("synthetic vector returned by reference: "
  		   "non-standard ABI extension with no compatibility guarantee");
  	  warned_for_return_big_vectors = true;
  	}
*************** rs6000_return_in_memory (tree type, tree
*** 4657,4662 ****
--- 4657,4663 ----
  
    if (DEFAULT_ABI == ABI_V4 && TYPE_MODE (type) == TFmode)
      return true;
+ 
    return false;
  }
  
*************** function_arg_boundary (enum machine_mode
*** 4808,4816 ****
  {
    if (DEFAULT_ABI == ABI_V4 && GET_MODE_SIZE (mode) == 8)
      return 64;
!   else if (SPE_VECTOR_MODE (mode))
      return 64;
!   else if (ALTIVEC_VECTOR_MODE (mode))
      return 128;
    else if (type && TREE_CODE (type) == VECTOR_TYPE
  	   && int_size_in_bytes (type) > 16)
--- 4809,4822 ----
  {
    if (DEFAULT_ABI == ABI_V4 && GET_MODE_SIZE (mode) == 8)
      return 64;
!   else if (SPE_VECTOR_MODE (mode)
! 	   || (type && TREE_CODE (type) == VECTOR_TYPE
! 	       && int_size_in_bytes (type) >= 8
! 	       && int_size_in_bytes (type) < 16))
      return 64;
!   else if (ALTIVEC_VECTOR_MODE (mode)
! 	   || (type && TREE_CODE (type) == VECTOR_TYPE
! 	       && int_size_in_bytes (type) >= 16))
      return 128;
    else if (type && TREE_CODE (type) == VECTOR_TYPE
  	   && int_size_in_bytes (type) > 16)
*************** function_arg_advance (CUMULATIVE_ARGS *c
*** 4895,4901 ****
    if (depth == 0)
      cum->nargs_prototype--;
  
!   if (TARGET_ALTIVEC_ABI && ALTIVEC_VECTOR_MODE (mode))
      {
        bool stack = false;
  
--- 4901,4910 ----
    if (depth == 0)
      cum->nargs_prototype--;
  
!   if (TARGET_ALTIVEC_ABI
!       && (ALTIVEC_VECTOR_MODE (mode)
! 	  || (type && TREE_CODE (type) == VECTOR_TYPE
! 	      && int_size_in_bytes (type) == 16)))
      {
        bool stack = false;
  
*************** function_arg (CUMULATIVE_ARGS *cum, enum
*** 5396,5402 ****
        }
      else
        return gen_rtx_REG (mode, cum->vregno);
!   else if (TARGET_ALTIVEC_ABI && ALTIVEC_VECTOR_MODE (mode))
      {
        if (named || abi == ABI_V4)
  	return NULL_RTX;
--- 5405,5414 ----
        }
      else
        return gen_rtx_REG (mode, cum->vregno);
!   else if (TARGET_ALTIVEC_ABI
! 	   && (ALTIVEC_VECTOR_MODE (mode)
! 	       || (type && TREE_CODE (type) == VECTOR_TYPE
! 		   && int_size_in_bytes (type) == 16)))
      {
        if (named || abi == ABI_V4)
  	return NULL_RTX;
*************** rs6000_pass_by_reference (CUMULATIVE_ARG
*** 5664,5670 ****
  
    /* Pass synthetic vectors in memory.  */
    if (type && TREE_CODE (type) == VECTOR_TYPE
!       && int_size_in_bytes (type) > (TARGET_ALTIVEC ? 16 : 8))
      {
        static bool warned_for_pass_big_vectors = false;
        if (TARGET_DEBUG_ARG)
--- 5676,5682 ----
  
    /* Pass synthetic vectors in memory.  */
    if (type && TREE_CODE (type) == VECTOR_TYPE
!       && int_size_in_bytes (type) > (TARGET_ALTIVEC_ABI ? 16 : 8))
      {
        static bool warned_for_pass_big_vectors = false;
        if (TARGET_DEBUG_ARG)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]