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]

[altivec] fix vec_cmplt


I have no idea how no one noticed this till now.

The arguments to the builtin in vec_cmplt should be reversed.

This patch fixes PR/8551.

Committing to mainline and branch.

Aldy

2002-12-18  Aldy Hernandez  <aldyh@redhat.com>

	* config/rs6000/altivec.h (vec_cmplt macro): Reverse arguments in
	macro.
	(vec_cmplt C++ functions): Reverse arguments.

Index: config/rs6000/altivec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/altivec.h,v
retrieving revision 1.20
diff -c -p -r1.20 altivec.h
*** config/rs6000/altivec.h	16 May 2002 01:12:42 -0000	1.20
--- config/rs6000/altivec.h	18 Dec 2002 23:26:23 -0000
*************** vec_cmple (vector float a1, vector float
*** 1102,1144 ****
  inline vector signed char
  vec_cmplt (vector unsigned char a1, vector unsigned char a2)
  {
!   return (vector signed char) __builtin_altivec_vcmpgtub ((vector signed char) a1, (vector signed char) a2);
  }
  
  inline vector signed char
  vec_cmplt (vector signed char a1, vector signed char a2)
  {
!   return (vector signed char) __builtin_altivec_vcmpgtsb ((vector signed char) a1, (vector signed char) a2);
  }
  
  inline vector signed short
  vec_cmplt (vector unsigned short a1, vector unsigned short a2)
  {
!   return (vector signed short) __builtin_altivec_vcmpgtuh ((vector signed short) a1, (vector signed short) a2);
  }
  
  inline vector signed short
  vec_cmplt (vector signed short a1, vector signed short a2)
  {
!   return (vector signed short) __builtin_altivec_vcmpgtsh ((vector signed short) a1, (vector signed short) a2);
  }
  
  inline vector signed int
  vec_cmplt (vector unsigned int a1, vector unsigned int a2)
  {
!   return (vector signed int) __builtin_altivec_vcmpgtuw ((vector signed int) a1, (vector signed int) a2);
  }
  
  inline vector signed int
  vec_cmplt (vector signed int a1, vector signed int a2)
  {
!   return (vector signed int) __builtin_altivec_vcmpgtsw ((vector signed int) a1, (vector signed int) a2);
  }
  
  inline vector signed int
  vec_cmplt (vector float a1, vector float a2)
  {
!   return (vector signed int) __builtin_altivec_vcmpgtfp ((vector float) a1, (vector float) a2);
  }
  
  /* vec_ctf */
--- 1102,1144 ----
  inline vector signed char
  vec_cmplt (vector unsigned char a1, vector unsigned char a2)
  {
!   return (vector signed char) __builtin_altivec_vcmpgtub ((vector signed char) a2, (vector signed char) a1);
  }
  
  inline vector signed char
  vec_cmplt (vector signed char a1, vector signed char a2)
  {
!   return (vector signed char) __builtin_altivec_vcmpgtsb ((vector signed char) a2, (vector signed char) a1);
  }
  
  inline vector signed short
  vec_cmplt (vector unsigned short a1, vector unsigned short a2)
  {
!   return (vector signed short) __builtin_altivec_vcmpgtuh ((vector signed short) a2, (vector signed short) a1);
  }
  
  inline vector signed short
  vec_cmplt (vector signed short a1, vector signed short a2)
  {
!   return (vector signed short) __builtin_altivec_vcmpgtsh ((vector signed short) a2, (vector signed short) a1);
  }
  
  inline vector signed int
  vec_cmplt (vector unsigned int a1, vector unsigned int a2)
  {
!   return (vector signed int) __builtin_altivec_vcmpgtuw ((vector signed int) a2, (vector signed int) a1);
  }
  
  inline vector signed int
  vec_cmplt (vector signed int a1, vector signed int a2)
  {
!   return (vector signed int) __builtin_altivec_vcmpgtsw ((vector signed int) a2, (vector signed int) a1);
  }
  
  inline vector signed int
  vec_cmplt (vector float a1, vector float a2)
  {
!   return (vector signed int) __builtin_altivec_vcmpgtfp ((vector float) a2, (vector float) a1);
  }
  
  /* vec_ctf */
*************** __ch (__bin_args_eq (vector unsigned cha
*** 6523,6529 ****
  
  #define vec_cmple(a1, a2) __builtin_altivec_vcmpgefp ((a1), (a2))
  
! #define vec_cmplt(a1, a2) \
  __ch (__bin_args_eq (vector unsigned char, (a1), vector unsigned char, (a2)), \
        ((vector signed char) __builtin_altivec_vcmpgtub ((vector signed char) (a1), (vector signed char) (a2))), \
  __ch (__bin_args_eq (vector signed char, (a1), vector signed char, (a2)), \
--- 6523,6529 ----
  
  #define vec_cmple(a1, a2) __builtin_altivec_vcmpgefp ((a1), (a2))
  
! #define vec_cmplt(a2, a1) \
  __ch (__bin_args_eq (vector unsigned char, (a1), vector unsigned char, (a2)), \
        ((vector signed char) __builtin_altivec_vcmpgtub ((vector signed char) (a1), (vector signed char) (a2))), \
  __ch (__bin_args_eq (vector signed char, (a1), vector signed char, (a2)), \


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