diff options
author | Richard Biener <rguenther@suse.de> | 2016-08-26 12:33:43 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-08-26 12:33:43 +0000 |
commit | ebfa15ab654738fcc926a506b3788a303958fa02 (patch) | |
tree | 36a9fb525064b262301c1f5214a7264dd4b939f2 /gcc/testsuite/gcc.dg | |
parent | 52066eae5d3dd6b7c0a1b843469582dbdbb941eb (diff) | |
download | gcc-ebfa15ab654738fcc926a506b3788a303958fa02.zip gcc-ebfa15ab654738fcc926a506b3788a303958fa02.tar.gz gcc-ebfa15ab654738fcc926a506b3788a303958fa02.tar.bz2 |
re PR tree-optimization/69047 (memcpy is not as optimized as union is)
2016-08-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/69047
* tree-ssa.c (maybe_rewrite_mem_ref_base): Handle general bitfield
extracts similar to what FRE does.
(non_rewritable_mem_ref_base): Likewise.
* gcc.dg/pr69047.c: New testcase.
From-SVN: r239778
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr69047.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr69047.c b/gcc/testsuite/gcc.dg/pr69047.c new file mode 100644 index 0000000..0227df2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69047.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-cddce1" } */ + +__UINT8_TYPE__ +f(__UINT16_TYPE__ b) +{ + __UINT8_TYPE__ a; +#if __BYTE_ORDER == __LITTLE_ENDIAN + __builtin_memcpy(&a, &b, sizeof a); +#elif __BYTE_ORDER == __BIG_ENDIAN + __builtin_memcpy(&a, (char *)&b + sizeof a, sizeof a); +#else + a = b; +#endif + return a; +} + +/* { dg-final { scan-tree-dump "_\[0-9\]+ = \\(\[^)\]+\\) b" "cddce1" } } */ |