comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP>
Subject: Re: Forcing GNAT to use 32-bit load/store instructions on ARM?
Date: Fri, 11 Jul 2014 20:22:11 +0000 (UTC)
Date: 2014-07-11T20:22:11+00:00	[thread overview]
Message-ID: <lpph1i$7q2$1@dont-email.me> (raw)
In-Reply-To: lybnsv3h5n.fsf@pushface.org

On 2014-07-11, Simon Wright <simon@pushface.org> wrote:
> Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> writes:
>
>> On 2014-07-10, Simon Wright <simon@pushface.org> wrote:
>>> Simon Wright <simon@pushface.org> writes:
>>>
>>>> The x86_64 code accesses all 32 bits of V. If it is more efficient on
>>>> arm to access the relevant bytes for the component assignments, I
>>>> expect that's what would happen (as reported).
>>>
>>> Just tried this on Raspberry Pi (GCC 4.6.3): yes, it only accesses the
>>> relevant bytes.
>>
>> Just to make sure: you mean it uses ldrb/strb instead of ldr/str
>> in the generated code ?
>
> Yes. I don't understand all the asm, but that part is clear!
>
> _ada_atom:
> 	@ args = 0, pretend = 0, frame = 0
> 	@ frame_needed = 0, uses_anonymous_args = 0
> 	@ link register save eliminated.
> 	ldr	r2, .L2
> 	ldr	r3, .L2+4
> 	ldmia	r2, {r1, r2}
> 	str	r1, [r3, #0]
> 	ldrb	r1, [r3, #0]	@ zero_extendqisi2
> 	bic	r1, r1, #1
> 	strb	r1, [r3, #0]
> 	ldrb	r1, [r3, #3]	@ zero_extendqisi2
                         ^^^ 
Eeeek! :-)

That's an "interesting" variant I have not seen before.

It looks like gcc is generating code to do a byte offset load directly
from the top byte of the 32-bit word. In my bitfield struct experiments
in C I only ever saw gcc use ldrb when the bitfield was in the low
8 bits of the 32-bit word. I never managed to get gcc to do the above.

Congratulations on finding yet another variant to this. :-)

> 	bic	r1, r1, #128
> 	strb	r1, [r3, #3]
> 	str	r2, [r3, #0]
> 	bx	lr

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

  reply	other threads:[~2014-07-11 20:22 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30 22:11 Forcing GNAT to use 32-bit load/store instructions on ARM? daniel.dmk
2014-06-30 23:41 ` Jeffrey Carter
2014-07-01 12:06   ` Simon Clubley
2014-07-01 15:44     ` Niklas Holsti
2014-07-01 17:26       ` Simon Clubley
2014-07-01 17:18     ` Simon Wright
2014-07-01 19:43       ` Simon Wright
2014-07-01 17:28     ` Jeffrey Carter
2014-07-01  0:55 ` anon
2014-07-01  4:30 ` Niklas Holsti
2014-07-01  8:11 ` Dmitry A. Kazakov
2014-07-01 12:09   ` Simon Clubley
2014-07-01 12:20     ` Dmitry A. Kazakov
2014-07-01 17:00       ` Simon Clubley
2014-07-01 19:36         ` Dmitry A. Kazakov
2014-07-01 20:08           ` Simon Clubley
2014-07-02 22:24             ` Randy Brukardt
2014-07-06 20:40               ` MatthiasR
2014-07-07  0:25                 ` Simon Clubley
2014-07-07 22:38                 ` Randy Brukardt
2014-07-08  6:51                   ` Simon Wright
2014-07-10 11:47                     ` Simon Wright
2014-07-10 13:06                       ` Simon Clubley
2014-07-11 18:05                         ` Simon Wright
2014-07-11 20:22                           ` Simon Clubley [this message]
2014-07-08  8:50                   ` Brian Drummond
2014-07-08 12:12                   ` Simon Clubley
2014-07-08 13:26                     ` G.B.
2014-07-08 17:13                       ` Simon Clubley
2014-07-08 15:36                     ` Adam Beneschan
2014-07-08 15:40                       ` Adam Beneschan
2014-07-08 20:34                     ` Randy Brukardt
2014-07-09  7:31                       ` Dmitry A. Kazakov
2014-07-10  0:11                         ` Simon Clubley
2014-07-20 11:35                   ` MatthiasR
2014-07-20 15:49                     ` Simon Clubley
2014-07-26 11:05                       ` MatthiasR
2014-08-10 11:20                         ` MatthiasR
2014-07-01 12:03 ` Simon Clubley
2014-07-01 19:52   ` daniel.dmk
2014-07-01 20:40     ` Simon Clubley
2014-07-01 20:55       ` Simon Clubley
2014-07-01 21:01       ` Niklas Holsti
2014-07-01 21:20         ` Simon Clubley
2014-07-01 22:38           ` Niklas Holsti
2014-07-02 16:49             ` Simon Clubley
2014-07-01 21:55         ` daniel.dmk
2014-07-02  7:30     ` Simon Wright
2014-07-02 18:52       ` daniel.dmk
2014-07-04 23:51       ` Niklas Holsti
2014-07-05  0:18         ` Niklas Holsti
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox