public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Koning <paulkoning@comcast.net>
To: Bernd Edlinger <bernd.edlinger@hotmail.de>
Cc: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Inefficient code
Date: Fri, 06 Jul 2018 12:55:00 -0000	[thread overview]
Message-ID: <C4E80C03-8DAB-4BF4-8860-F7588C2B41E2@comcast.net> (raw)
In-Reply-To: <AM5PR0701MB265749C6DC486524A8D75710E4470@AM5PR0701MB2657.eurprd07.prod.outlook.com>



> On Jul 6, 2018, at 6:18 AM, Bernd Edlinger <bernd.edlinger@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

  reply	other threads:[~2018-07-06 12:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-06 10:18 Bernd Edlinger
2018-07-06 12:55 ` Paul Koning [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-07-05 12:46 Paul Koning
2018-07-05 16:01 ` Segher Boessenkool
2018-07-05 16:29   ` Paul Koning
2018-07-05 20:44     ` Eric Botcazou
2018-07-05 20:53       ` Paul Koning
2018-07-05 22:47         ` Eric Botcazou
2018-07-06  1:01           ` Paul Koning
2018-07-06  1:04             ` Paul Koning
2018-07-06  6:54               ` Eric Botcazou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C4E80C03-8DAB-4BF4-8860-F7588C2B41E2@comcast.net \
    --to=paulkoning@comcast.net \
    --cc=bernd.edlinger@hotmail.de \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).