https://bugs.llvm.org/show_bug.cgi?id=49822
Bug ID: 49822
Summary: Missed fold for copysign on integers
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: rif...@purdue.edu
CC: llvm-bugs@lists.llvm.org
C++ has no std::sign function. std::copysign may be used for this functionality
with a call along the lines of: std::copysign(1, n).
When std::copysign is provided with an integer argument and the return value is
immediately cast to an integer, the copysign call can be folded away in favor
of an icmp/select pattern along the lines of that produced for (n < 0 ? -1 :
1).
Currently, the generated assembly for copysign includes an int -> float
conversion followed shortly by a float -> int conversion.
https://godbolt.org/z/MoPr9javo
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs