[llvm-bugs] [Bug 48981] New: [AVR] Bad optimization of multiplication when mul instruction is available
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jan 31 22:18:16 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=48981
Bug ID: 48981
Summary: [AVR] Bad optimization of multiplication when mul
instruction is available
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: AVR
Assignee: unassignedbugs at nondot.org
Reporter: gabravier at gmail.com
CC: llvm-bugs at lists.llvm.org
int square(int num)
{
return num * num;
}
GCC -O3 generates this:
square(int):
movw r18,r24
mul r18,r18
movw r24,r0
mul r18,r19
add r25,r0
add r25,r0
clr r1
ret
LLVM generates this:
square(int):
muls r25, r24
mov r18, r0
clr r1
muls r24, r25
mov r19, r0
clr r1
mul r24, r24
mov r20, r1
clr r1
add r20, r19
add r20, r18
lsl r20
rol r21
lsl r20
rol r21
lsl r20
rol r21
lsl r20
rol r21
lsl r20
rol r21
lsl r20
rol r21
lsl r20
rol r21
lsl r20
rol r21
mov r24, r0
clr r25
or r24, r20
or r25, r21
ret
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210201/09886bde/attachment.html>
More information about the llvm-bugs
mailing list