[llvm-bugs] [Bug 51245] New: [X86][SSE] Reduce FPU->GPR traffic by performing fcmp logic on FPU
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 28 02:52:29 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51245
Bug ID: 51245
Summary: [X86][SSE] Reduce FPU->GPR traffic by performing fcmp
logic on FPU
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, pengfei.wang at intel.com,
spatel+llvm at rotateright.com
https://godbolt.org/z/o7zzn7Gc6
bool f32cmp2(float x, float y, float z, float w) {
return (x < y) != (z < w);
}
clang -g0 -O3 -march=btver2
f32cmp2:
vucomiss %xmm0, %xmm1
seta %cl
vucomiss %xmm2, %xmm3
seta %al
xorb %cl, %al
retq
We can reduce fpu->gpr traffic by using 2 x cmpss instead, performing the xor
on the fpu and then just transferring the result:
f32cmp2:
vcmpltss %xmm1, %xmm0, %xmm0
vcmpltss %xmm3, %xmm2, %xmm2
vxorps %xmm0, %xmm2, %xmm2
vmovd %xmm2, %eax
andb $1, %al
https://llvm.godbolt.org/z/xKWrPo88f
--
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/20210728/9e508df9/attachment.html>
More information about the llvm-bugs
mailing list