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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
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._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs