[test-suite] r242000 - Fix print_element in polybench.h to be big-Endian friendly

Hal Finkel hfinkel at anl.gov
Sun Jul 12 16:43:59 PDT 2015


Author: hfinkel
Date: Sun Jul 12 18:43:59 2015
New Revision: 242000

URL: http://llvm.org/viewvc/llvm-project?rev=242000&view=rev
Log:
Fix print_element in polybench.h to be big-Endian friendly

In r241675, print_element was added to polybench.h so make printing out the
arrays faster. Unfortunately, it is not Endian neutral, and so the updated tests
were failing validation on big-Endian systems when using the reference outputs.

Modified:
    test-suite/trunk/SingleSource/Benchmarks/Polybench/utilities/polybench.h

Modified: test-suite/trunk/SingleSource/Benchmarks/Polybench/utilities/polybench.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Polybench/utilities/polybench.h?rev=242000&r1=241999&r2=242000&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Polybench/utilities/polybench.h (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Polybench/utilities/polybench.h Sun Jul 12 18:43:59 2015
@@ -619,6 +619,16 @@ void print_element(float el, int pos, ch
 
   block.datum = el;
   /* each nibble as a char, within the printable range */
+#ifdef __BIG_ENDIAN__
+  *(out+pos+7) = (block.bytes[0]&0xF0>>4)+'0';
+  *(out+pos+6) = (block.bytes[0]&0x0F)   +'0';
+  *(out+pos+5) = (block.bytes[1]&0xF0>>4)+'0';
+  *(out+pos+4) = (block.bytes[1]&0x0F)   +'0';
+  *(out+pos+3) = (block.bytes[2]&0xF0>>4)+'0';
+  *(out+pos+2) = (block.bytes[2]&0x0F)   +'0';
+  *(out+pos+1) = (block.bytes[3]&0xF0>>4)+'0';
+  *(out+pos) =   (block.bytes[3]&0x0F)   +'0';
+#else
   *(out+pos)   = (block.bytes[0]&0xF0>>4)+'0';
   *(out+pos+1) = (block.bytes[0]&0x0F)   +'0';
   *(out+pos+2) = (block.bytes[1]&0xF0>>4)+'0';
@@ -627,6 +637,7 @@ void print_element(float el, int pos, ch
   *(out+pos+5) = (block.bytes[2]&0x0F)   +'0';
   *(out+pos+6) = (block.bytes[3]&0xF0>>4)+'0';
   *(out+pos+7) = (block.bytes[3]&0x0F)   +'0';
+#endif
 }
 
 #endif /* !POLYBENCH_H */





More information about the llvm-commits mailing list