[llvm-bugs] [Bug 45036] New: fast math flags on fcmp scalarizes on aarch64
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 26 10:52:32 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=45036
Bug ID: 45036
Summary: fast math flags on fcmp scalarizes on aarch64
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: AArch64
Assignee: unassignedbugs at nondot.org
Reporter: andrew.b.adams at gmail.com
CC: arnaud.degrandmaison at arm.com,
llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
Ties.Stuij at arm.com
Created attachment 23176
--> https://bugs.llvm.org/attachment.cgi?id=23176&action=edit
ll that demonstrates the problem
Any fast math flags on an fcmp seem to cause the aarch64 backend to emit a
sequence of scalar fcmp instructions instead of a single vector fcmgt
instruction.
The following ll shows the same comparison, with and without a fast math flag.
I turned them all on, but it seems that any fast math flag will do.
define <4 x i1> @good(<4 x float> %a, <4 x float> %b) {
%c = fcmp olt <4 x float> %a, %b
ret <4 x i1> %c
}
define <4 x i1> @bad(<4 x float> %a, <4 x float> %b) {
%c = fcmp fast olt <4 x float> %a, %b
ret <4 x i1> %c
}
Output from llc -march=aarch64 -filetype=asm fcmgt.ll -o -
...
good:
fcmgt v0.4s, v1.4s, v0.4s
xtn v0.4h, v0.4s
ret
...
bad:
mov s2, v1.s[1]
mov s3, v0.s[1]
fcmp s3, s2
csetm w8, lt
fcmp s0, s1
mov s4, v1.s[2]
mov s2, v0.s[2]
csetm w9, lt
mov s3, v1.s[3]
mov s0, v0.s[3]
fcmp s2, s4
fmov s1, w9
csetm w9, lt
fcmp s0, s3
mov v1.s[1], w8
mov v1.s[2], w9
csetm w8, lt
mov v1.s[3], w8
xtn v0.4h, v1.4s
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/20200226/ddfabc65/attachment.html>
More information about the llvm-bugs
mailing list