[llvm-bugs] [Bug 34558] New: use SDNodeFlags to enable reciprocal square root transform
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 11 10:21:44 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34558
Bug ID: 34558
Summary: use SDNodeFlags to enable reciprocal square root
transform
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: llvm-bugs at lists.llvm.org
Given IR with fast-math-flags, those attributes should be passed on to the
corresponding FP nodes in the DAG:
define float @fast_recip_sqrt(float %x) {
%y = call fast float @llvm.sqrt.f32(float %x)
%z = fdiv fast float 1.0, %y
ret float %z
}
declare float @llvm.sqrt.f32(float) nounwind readonly
-------------------------------------------------------------------------------
For x86, this should trigger a reciprocal square root estimate optimization:
rsqrtss %xmm0, %xmm1
mulss %xmm1, %xmm0
mulss %xmm1, %xmm0
addss LCPI0_0(%rip), %xmm0
mulss LCPI0_1(%rip), %xmm1
mulss %xmm1, %xmm0
retq
There are currently 2 problems:
1. We don't apply FMF to intrinsics ( https://reviews.llvm.org/D37686 proposes
to fix this), so the sqrt node isn't marked with any relaxed FP properties.
2. The code in DAGCombiner::visitFDIV() doesn't check flags on nodes.
--
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/20170911/743198ea/attachment.html>
More information about the llvm-bugs
mailing list