OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr43280.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* { dg-require-effective-target stdint_types } */
3
/* { dg-options "-O2" } */
4
 
5
#include <stdint.h>
6
 
7
extern void abort (void);
8
 
9
uint64_t __attribute__((noinline))
10
byteswap64(uint64_t x)
11
{
12
  uint32_t a = x >> 32;
13
  uint32_t b = (uint32_t) x;
14
  return ((uint64_t) ((((((b)) >> (8)) | (((b)) << (32 - (8)))) & 0xff00ff00L)
15
                      | (((((b)) << (8)) | (((b)) >> (32 - (8)))) & 0x00ff00ffL)) << 32)
16
          | (uint64_t) ((((((a)) >> (8)) | (((a)) << (32 - (8)))) & 0xff00ff00L)
17
                        | (((((a)) << (8)) | (((a)) >> (32 - (8)))) & 0x00ff00ffL));
18
}
19
 
20
int
21
main ()
22
{
23
  uint64_t in = (uint64_t)0x01020304 << 32 | 0x05060708;
24
  uint64_t cmp = (uint64_t)0x08070605 << 32 | 0x04030201;
25
 
26
  if (cmp != byteswap64 (in))
27
    abort ();
28
 
29
  return 0;
30
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.