From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47406 invoked by alias); 6 Jul 2018 12:55:18 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 47393 invoked by uid 89); 6 Jul 2018 12:55:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=coded, H*f:sk:AM5PR07, H*i:sk:AM5PR07, transfer X-HELO: resqmta-po-02v.sys.comcast.net Received: from resqmta-po-02v.sys.comcast.net (HELO resqmta-po-02v.sys.comcast.net) (96.114.154.161) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jul 2018 12:55:16 +0000 Received: from resomta-po-10v.sys.comcast.net ([96.114.154.234]) by resqmta-po-02v.sys.comcast.net with ESMTP id bPf6fjsDbQSv9bQGZfn189; Fri, 06 Jul 2018 12:55:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1530881715; bh=4LgyXpGUIB0KF+dPAQ2qpygKvHDhLth3diZ1+4R81gc=; h=Received:Received:Content-Type:Mime-Version:Subject:From:Date: Message-Id:To; b=mggF06XmnbtX26ROHynSlF1ZyWc6MolgMJ/vrnSrdmoYI5EA1jFWbyOH2SEjDB/3b oiMHq5n1ygFi68dlM0UOxFoA18sSVBUeydz+5oflonNwLRLYvzcC02YaVGruxLKNmF txAa57gioVDBn4sY1WeS7byXIuJUtz8HcqejBrZxcF1ulMGaopIV+ZxACNpBUtuHLQ Iww5WhRfymt2KZRsaphSH0SBYCj3JBkQhPLln+R4Md1oT9t/JIswiO2+sCGYINn7U7 Oi6lseM8OeW2G/EyOujYDvGM90Yla/veRDTbHUuqgcVozGCdfegnZTZEdjnA2ljvGZ SMleot+uj2k5A== Received: from [192.168.10.125] ([73.60.223.101]) by resomta-po-10v.sys.comcast.net with ESMTPA id bQGXfWTRbKNzAbQGYfP1XK; Fri, 06 Jul 2018 12:55:15 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: Re: Inefficient code From: Paul Koning In-Reply-To: Date: Fri, 06 Jul 2018 12:55:00 -0000 Cc: "gcc@gcc.gnu.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Bernd Edlinger X-SW-Source: 2018-07/txt/msg00110.txt.bz2 > On Jul 6, 2018, at 6:18 AM, Bernd Edlinger wr= ote: >=20 > You can get much better code if you make xrci a bit field. > so the entire bit filed region can be accessed word-wise: >=20 >=20 > #include >=20 > 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 */ > }; >=20 > void test(struct Xrb *XRB) > { > XRB->xrblk =3D 5; > } >=20 >=20 > Bernd. That helps with x86. It makes no difference with xstormy16, and it makes t= hings slightly worse with pdp11 (though I can fiddle with the patterns to h= elp 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 thi= s a missed optimization. paul