An tiny optimization to the ARMv6 backend

415 views
Skip to first unread message

Ben Shi

unread,
Dec 12, 2016, 8:32:45 PM12/12/16
to golang-dev
Hello, Golang developers,

I find the following lines (line 95 - 107) https://github.com/golang/go/blob/master/src/cmd/compile/internal/ssa/gen/ARM.rules

// byte swap
// let (a, b, c, d) be the bytes of x from high to low
// t1 = x right rotate 16 bits -- (c,   d,   a,   b  )
// t2 = x ^ t1                 -- (a^c, b^d, a^c, b^d)
// t3 = t2 &^ 0xff0000         -- (a^c, 0,   a^c, b^d)
// t4 = t3 >> 8                -- (0,   a^c, 0,   a^c)
// t5 = x right rotate 8 bits  -- (d,   a,   b,   c  )
// result = t4 ^ t5            -- (d,   c,   b,   a  )
// using shifted ops this can be done in 4 instructions.
(Bswap32 <t> x) ->
    (XOR <t>
        (SRLconst <t> (BICconst <t> (XOR <t> x (SRRconst <t> [16] x)) [0xff0000]) [8])
(SRRconst <t> x [8]))

I thought they can be optimized to a simple REV instruction, which is avaliable in ARMv6. This instruction is described on page 562 of the "ARM Architecture Reference Manual" rev C.c.

If I want to make this change, should I follow the "contributing Guildline" https://golang.org/doc/contribute.html ?
 
Ben Shi

cherry

unread,
Dec 12, 2016, 10:03:56 PM12/12/16
to Ben Shi, golang-dev
In Go 1.8 we still support ARMv5 (https://tip.golang.org/doc/go1.8#ports).


If I want to make this change, should I follow the "contributing Guildline" https://golang.org/doc/contribute.html ?

Yes, go submit the change when Go 1.9 tree is open in February.

Ben Shi

unread,
Dec 12, 2016, 10:47:40 PM12/12/16
to cherry, golang-dev
So currently the ARM.rules and ARMOps.go are not optimized due to compatibility of ARMv5?

And no submit about ARM is accepted until Feb 2017?



minux

unread,
Dec 12, 2016, 11:15:57 PM12/12/16
to Ben Shi, cherry, golang-dev
On Mon, Dec 12, 2016 at 10:46 PM, Ben Shi <power...@163.com> wrote:
So currently the ARM.rules and ARMOps.go are not optimized due to compatibility of ARMv5?
Yes. That's at least part of the reason. We plan to drop support for ARMv5 in
Go 1.9, so we can use all ARMv6 instructions then.


And no submit about ARM is accepted until Feb 2017?
We're in code freeze in preparation for the 1.8 release, so only bug fixes
and docs changes are accepted until the tree reopens in Feb 2017. It's
not only about ARM changes.

Please see golang.org/s/releasesched for details about Go's release schedule.

Keith Randall

unread,
Dec 12, 2016, 11:20:03 PM12/12/16
to minux, Ben Shi, cherry, golang-dev
Note that you can get your code all done, tested, code reviewed, and ready to submit right now.  We just can't press the submit button until Feb.


--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dan Kortschak

unread,
Dec 15, 2016, 7:11:29 PM12/15/16
to minux, golang-dev
Is this set in stone? I have hardware that cannot be upgraded and is
ARMv5l.

Brad Fitzpatrick

unread,
Dec 15, 2016, 7:12:42 PM12/15/16
to Dan Kortschak, minux, golang-dev
You're now the second person asking for continued arm5 support.

Not in stone yet.


Dan Kortschak

unread,
Dec 15, 2016, 7:14:16 PM12/15/16
to Brad Fitzpatrick, minux, golang-dev
Yeah, thanks - I just got to that thread. Thank you for the
consideration.

minux

unread,
Dec 15, 2016, 8:39:35 PM12/15/16
to Dan Kortschak, golang-dev
On Thu, Dec 15, 2016 at 7:11 PM, Dan Kortschak <dan.ko...@adelaide.edu.au> wrote:
Is this set in stone? I have hardware that cannot be upgraded and is
ARMv5l.

There will always be ARMv5 hardware out there. I think we need to set a
criteria for retaining the support for ARMv5 and ARMv6 (prior to ARMv6K).

One such criteria could be finding a real ARMv5E builder. Without a builder,
there is no point in maintaining ARMv5 support.

Let's continue the discussion in #17082.
Reply all
Reply to author
Forward
0 new messages