This is the mail archive of the gcc@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: gcc.dg/compat/struct-layout-1.exp does not supported installed-compilertesting


Jakub Jelinek wrote:

+ #ifndef WORDS_BIGENDIAN
+   /* On a little-endian machine, if the data is 4-byte aligned we can hash
+      by word for better speed.  This gives nondeterministic results on
+      big-endian machines.  */


WORDS_BIGENDIAN is not being defined in the headers that are included.
I think best would be just to kill this hunk and unconditionally do it the
slower way.

Good point! I checked in this patch, on mainline and 4.0 branches, after testing on x86_64-unknown-linux-gnu.


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
2005-05-17  Mark Mitchell  <mark@codesourcery.com>

	* gcc.dg/compat/struct-layout-1_generate.c (iterative_hash):
	Remove little-endian optimizations. 

Index: struct-layout-1_generate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c,v
retrieving revision 1.5
diff -c -5 -p -r1.5 struct-layout-1_generate.c
*** struct-layout-1_generate.c	16 May 2005 22:52:26 -0000	1.5
--- struct-layout-1_generate.c	17 May 2005 18:22:25 -0000
*************** iterative_hash (const void *k_in /* the 
*** 1223,1247 ****
    len = length;
    a = b = 0x9e3779b9;  /* the golden ratio; an arbitrary value */
    c = initval;           /* the previous hash value */
  
    /*---------------------------------------- handle most of the key */
- #ifndef WORDS_BIGENDIAN
-   /* On a little-endian machine, if the data is 4-byte aligned we can hash
-      by word for better speed.  This gives nondeterministic results on
-      big-endian machines.  */
-   if (sizeof (hashval_t) == 4 && (((size_t)k)&3) == 0)
-     while (len >= 12)    /* aligned */
-       {
- 	a += *(hashval_t *)(k+0);
- 	b += *(hashval_t *)(k+4);
- 	c += *(hashval_t *)(k+8);
- 	mix(a,b,c);
- 	k += 12; len -= 12;
-       }
-   else /* unaligned */
- #endif
      while (len >= 12)
        {
  	a += (k[0] +((hashval_t)k[1]<<8) +((hashval_t)k[2]<<16) +((hashval_t)k[3]<<24));
  	b += (k[4] +((hashval_t)k[5]<<8) +((hashval_t)k[6]<<16) +((hashval_t)k[7]<<24));
  	c += (k[8] +((hashval_t)k[9]<<8) +((hashval_t)k[10]<<16)+((hashval_t)k[11]<<24));
--- 1223,1232 ----

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