diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-05-08 07:23:25 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-05-10 05:04:51 -0700 |
commit | 1f94ed3b4c308c9da7baf59ecbc0f953e994f9c4 (patch) | |
tree | 1b615e69516cae6b435a3eb03949ea22dfecba0f | |
parent | 3e5605f0a961f9688f4c84b59d3e62ad23530fc4 (diff) | |
download | gcc-1f94ed3b4c308c9da7baf59ecbc0f953e994f9c4.zip gcc-1f94ed3b4c308c9da7baf59ecbc0f953e994f9c4.tar.gz gcc-1f94ed3b4c308c9da7baf59ecbc0f953e994f9c4.tar.bz2 |
Add a test for PR tree-optimization/42587
PR tree-optimization/42587
* gcc.dg/optimize-bswapsi-6.c: New test.
-rw-r--r-- | gcc/testsuite/gcc.dg/optimize-bswapsi-6.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c new file mode 100644 index 0000000..3c089b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c @@ -0,0 +1,38 @@ +/* PR tree-optimization/42587 */ +/* { dg-do compile } */ +/* { dg-require-effective-target bswap } */ +/* { dg-options "-O2 -fdump-tree-store-merging" } */ +/* { dg-additional-options "-march=z900" { target s390-*-* } } */ + +typedef unsigned char u8; +typedef unsigned int u32; +union __anonunion_out_195 +{ + u32 value; + u8 bytes[4]; +}; +union __anonunion_in_196 +{ + u32 value; + u8 bytes[4]; +}; +extern void acpi_ut_track_stack_ptr (void); +u32 acpi_ut_dword_byte_swap (u32 value); +u32 +acpi_ut_dword_byte_swap (u32 value) +{ + union __anonunion_out_195 out; + union __anonunion_in_196 in; + + { + acpi_ut_track_stack_ptr (); + in.value = value; + out.bytes[0] = in.bytes[3]; + out.bytes[1] = in.bytes[2]; + out.bytes[2] = in.bytes[1]; + out.bytes[3] = in.bytes[0]; + return (out.value); + } +} + +/* { dg-final { scan-tree-dump "32 bit bswap implementation found at" "store-merging" } } */ |