Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.dg/optimize-bswapsi-4.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
line wrap: on
line source
/* { dg-do compile } */ /* { dg-require-effective-target bswap } */ /* { dg-options "-O2 -fdump-tree-bswap" } */ /* { dg-additional-options "-march=z900" { target s390-*-* } } */ typedef unsigned char u8; typedef unsigned int u32; union __anonunion { u32 value; u8 bytes[4]; }; u32 acpi_ut_dword_byte_swap (u32 value) { union __anonunion in; in.value = value; #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ return ((in.bytes[0] << 24) | (in.bytes[1] << 16) | (in.bytes[2] << 8) | in.bytes[3]); #else return ((in.bytes[3] << 24) | (in.bytes[2] << 16) | (in.bytes[1] << 8) | in.bytes[0]); #endif } /* { dg-final { scan-tree-dump "32 bit bswap implementation found at" "bswap" } } */