[llvm-bugs] [Bug 41069] New: multiple isnan() checks enhancement
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Mar 14 08:43:00 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41069
Bug ID: 41069
Summary: multiple isnan() checks enhancement
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: kobalicek.petr at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
It would be nice if clang/LLVM can merge multiple isnan checks into `ucomisd a,
b`. Consider the following C++ Code:
#include <cmath>
#include <algorithm>
bool isNaN(double a, double b, double c, double d) {
return std::isnan(a) |
std::isnan(b) |
std::isnan(c) |
std::isnan(d) ;
}
Clang Output
------------
isNaN(double, double, double, double):
ucomisd xmm0, xmm1 ## THIS IS OKAY
setp al
ucomisd xmm2, xmm2 ## HERE IS SOME PROBLEM
setp cl
or cl, al
ucomisd xmm3, xmm3
setp al
or al, cl
ret
GCC Output
----------
isNaN(double, double, double, double):
ucomisd xmm0, xmm1
setp al
ucomisd xmm2, xmm3
setp dl
or eax, edx
ret
It seems that the pattern is already recognized but not applied to second and
third isnan checks.
--
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/20190314/2c37e897/attachment-0001.html>
More information about the llvm-bugs
mailing list