[Bug tree-optimization/65426] New: Recognize byte-swaps when writing to buffers
fuz at fuz dot su
gcc-bugzilla@gcc.gnu.org
Sat Mar 14 18:16:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65426
Bug ID: 65426
Summary: Recognize byte-swaps when writing to buffers
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: fuz at fuz dot su
Created attachment 35036
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35036&action=edit
Various instances of the aforementioned pattern
It would be great if gcc could recognize code like this:
static inline void
wm32(uint8_t a[4], uint32_t x)
{
a[0] = x >> 24;
a[1] = x >> 16;
a[2] = x >> 8;
a[3] = x >> 0;
}
and turn it into a single unaligned write (and perhaps a byte swap on platforms
where this is supported). This kind of code appears when one tries to write
marshalling code in a portable fashion.
Attached is a file containing various instances of this pattern.
More information about the Gcc-bugs
mailing list