[llvm-dev] [cfe-dev] [RFC][ARM] -Oz implies -mthumb

Bruce Hoult via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 15 05:01:27 PST 2018


Well, yes. Thumb1 was not clear cut, but with Thumb2 there are I think only
two possible things that can make Thumb very slightly slower than ARM:

1) needing an extra IT instruction to cast predication over following
instructions
2) on some microarchitectures there might be a penalty for branching to an
address that isn't 4-byte aligned. (probably not on recent ones)

On Thu, Nov 15, 2018 at 4:39 AM, Tim Northover <t.p.northover at gmail.com>
wrote:

> On Thu, 15 Nov 2018 at 12:25, Bruce Hoult <brucehoult at sifive.com> wrote:
> > OK, I just checked, and -mcpu=cortex-{m3,m4,m7,a7,a9,a15,a53} gives
> Thumb at -O1, -O1, -Os on the following gcc:
>
> If anything I'd be inclined to just default to Thumb always. I haven't
> checked myself, but rumour has it the icache benefits make it faster
> than ARM code as well as smaller in most cases. My one worry there is
> with reset vectors, which I believe must be implemented in ARM in some
> cases; but since GCC itself appears to be inconsistent here, hopefully
> those people are already explicit about their needs.
>
> Cheers.
>
> Tim.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181115/63191417/attachment.html>


More information about the llvm-dev mailing list