| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target bswap } */ |
| 3 |
/* { dg-require-effective-target stdint_types } */ |
| 4 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 5 |
/* { dg-additional-options "-march=z900" { target s390-*-* } } */ |
| 6 |
|
| 7 |
typedef int SItype __attribute__ ((mode (SI))); |
| 8 |
typedef int DItype __attribute__ ((mode (DI))); |
| 9 |
|
| 10 |
/* This variant comes from optimize-bswapsi-1.c swap32_d. It detects a missing |
| 11 |
cast of MARKER_BYTE_UNKNOWN to uint64_t for the CASE_CONVERT case for host |
| 12 |
architecture where a left shift with too big an operand gives zero. */ |
| 13 |
|
| 14 |
SItype |
| 15 |
swap32 (SItype in) |
| 16 |
{ |
| 17 |
return (((in >> 0) & 0xFF) << 24) |
| 18 |
| (((in >> 8) & 0xFF) << 16) |
| 19 |
| (((((DItype) in) & 0xFF00FF0000llu) >> 16) << 8) |
| 20 |
| (((in >> 24) & 0xFF) << 0); |
| 21 |
} |
| 22 |
|
| 23 |
/* { dg-final { scan-tree-dump-times "= __builtin_bswap32 \\\(" 1 "optimized" } } */ |