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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [optimize-bswapdi-2.c] - Blame information for rev 753

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile { target arm*-*-* alpha*-*-* ia64*-*-* x86_64-*-* s390x-*-* powerpc*-*-* rs6000-*-* } } */
2
/* { dg-require-effective-target stdint_types } */
3
/* { dg-require-effective-target lp64 } */
4
/* { dg-options "-O2 -fdump-tree-bswap" } */
5
 
6
#include <stdint.h>
7
 
8
/* A variant via unsigned short.  */
9
 
10
uint64_t
11
swap64_c (uint64_t x)
12
{
13
  uint16_t a0 = x >> 48;
14
  uint16_t a1 = x >> 32;
15
  uint16_t a2 = x >> 16;
16
  uint16_t a3 = x;
17
 
18
  return ((uint64_t) (((a0 >> 8) & 0xff) | ((a0 << 8) & 0xff00)))
19
        | ((uint64_t) (((a1 >> 8) & 0xff) | ((a1 << 8) & 0xff00)) << 16)
20
        | ((uint64_t) (((a2 >> 8) & 0xff) | ((a2 << 8) & 0xff00)) << 32)
21
        | ((uint64_t) (((a3 >> 8) & 0xff) | ((a3 << 8) & 0xff00)) << 48);
22
}
23
 
24
 
25
/* { dg-final { scan-tree-dump-times "64 bit bswap implementation found at" 1 "bswap" } } */
26
/* { dg-final { cleanup-tree-dump "bswap" } } */

powered by: WebSVN 2.1.0

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