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 | |
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')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr69047.c | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e51756d..86ef6a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-08-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/69047 + * gcc.dg/pr69047.c: New testcase. + 2016-08-26 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> Martin Jambhor <mjambor@suse.cz> 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" } } */ |