> On Jul 6, 2018, at 6:18 AM, Bernd Edlinger <bernd.edlin...@hotmail.de> wrote:
>
> You can get much better code if you make xrci a bit field.
> so the entire bit filed region can be accessed word-wise:
>
>
> #include <stdint.h>
>
> struct Xrb
> {
> uint16_t xrlen; /* Length of I/O buffer in bytes */
> uint16_t xrbc; /* Byte count for transfer */
> void * xrloc; /* Pointer to I/O buffer */
> uint8_t xrci:8; /* Channel number times 2 for transfer */
> uint32_t xrblk:24; /* Random access block number */
> uint16_t xrtime; /* Wait time for terminal input */
> uint16_t xrmod; /* Modifiers */
> };
>
> void test(struct Xrb *XRB)
> {
> XRB->xrblk = 5;
> }
>
>
> Bernd.
That helps with x86. It makes no difference with xstormy16, and it makes
things slightly worse with pdp11 (though I can fiddle with the patterns to help
with that; there's a zero_extend optimization I haven't coded yet).
On the other hand, since the two are equivalent it's reasonable to call this a
missed optimization.
paul