This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/82038] Very poor optimization of constant multiply on ARM Cortex-M7
- From: "headch at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Aug 2017 15:55:02 +0000
- Subject: [Bug target/82038] Very poor optimization of constant multiply on ARM Cortex-M7
- Auto-submitted: auto-generated
- References: <bug-82038-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82038
--- Comment #2 from Christopher Head <headch at gmail dot com> ---
I think they do. Just one example, but I’m pretty sure it holds for others too
(left-shift equals multiply by power of two, even for negative integers; it’s
right-shift where the behaviour differs due to different rounding):
== On entry ==
r0 = -16 = 0xFFFFFFF0
== f ==
0:
2: r5 = r0 ASR 31 = 0xFFFFFFFF
4: r3 = r0 = 0xFFFFFFF0
6: r0 = r0 << 14 = 0xFFFC0000
8: r1 = r5 << 14 = 0xFFFFC000
a:
c: r1 = r1 | (r3 LSR 18)
= 0xFFFFC000 | (0xFFFFFFF0 LSR 18)
= 0xFFFFC000 | 0x00003FFF
= 0xFFFFFFFF
On exit, r1:r0 = 0xFFFFFFFF : 0xFFFC0000 = -262,144
== g ==
14: r1 = r0 = 0xFFFFFFF0
16: r0 = r0 << 14 = 0xFFFC0000
18: r1 = r1 ASR 18 = 0xFFFFFFFF
On exit, r1:r0 = 0xFFFFFFFF : 0xFFFC0000 = -262,144