1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

117 Commits

Author SHA1 Message Date
Arnold Schwaighofer
83cedfffb0 PatternMatch: Matcher for (un)ordered floating point min/max
Add support for matching 'ordered' and 'unordered' floating point min/max
constructs.

In LLVM we can express min/max functions as a combination of compare and select.
We have support for matching such constructs for integers but not for floating
point. In floating point math there is no total order because of the presence of
'NaN'. Therefore, we have to be careful to preserve the original fcmp semantics
when interpreting floating point compare select combinations as a minimum or
maximum function. The resulting 'ordered/unordered' floating point maximum
function has to select the same value as the select/fcmp combination it is based
on.

 ordered_max(x,y)   = max(x,y) iff x and y are not NaN, y otherwise
 unordered_max(x,y) = max(x,y) iff x and y are not NaN, x otherwise
 ordered_min(x,y)   = min(x,y) iff x and y are not NaN, y otherwise
 unordered_min(x,y) = min(x,y) iff x and y are not NaN, x otherwise

This matches the behavior of the underlying select(fcmp(olt/ult/.., L, R), L, R)
construct.

Any code using this predicate has to preserve this semantics.

A follow-up patch will use this to implement floating point min/max reductions
in the vectorizer.

radar://13723044

llvm-svn: 181143
2013-05-05 01:54:46 +00:00
Benjamin Kramer
b7bf971543 Fix a disconcerting bug in Value::isUsedInBasicBlock, which gave wrong answers for blocks larger than 3 instrs.
Also add a unit test. PR15727.

llvm-svn: 179370
2013-04-12 08:33:11 +00:00
Dan Gohman
7eac0c2694 Change GetPointerBaseWithConstantOffset's DataLayout argument from a
reference to a pointer, so that it can handle the case where DataLayout
is not available and behave conservatively.

llvm-svn: 174024
2013-01-31 02:00:45 +00:00
Bill Wendling
761ddf3dd9 Fix test to not use the AttributeSet's AttributeWithIndex creation method.
llvm-svn: 173608
2013-01-27 03:39:10 +00:00
NAKAMURA Takumi
d0d93db5cb llvm/unittests: Use OwningPtr to fix --vg-leak.
llvm-svn: 173240
2013-01-23 08:33:13 +00:00
NAKAMURA Takumi
634ae981a3 IRTests/WaymarkTest.cpp: Fix in --vg-leak.
llvm-svn: 173239
2013-01-23 08:33:05 +00:00
NAKAMURA Takumi
be9f7c27f1 IRTests/IRBuilderTest.cpp: GetIntTy: Delete DL at yourself since it is not linked.
llvm-svn: 173238
2013-01-23 08:31:28 +00:00
NAKAMURA Takumi
9a7842a6f2 IRTests/IRBuilderTest.cpp: Let GV added to the module.
It fixes --vg-leak.

llvm-svn: 173237
2013-01-23 08:30:39 +00:00
NAKAMURA Takumi
71fc8c35b0 IRTests/ConstantsTest.cpp: AsInstructionsTest: Delete each instruction immediately if it is not linked.
llvm-svn: 173236
2013-01-23 08:30:26 +00:00
NAKAMURA Takumi
90605a6d70 Untabify.
llvm-svn: 173235
2013-01-23 08:30:21 +00:00
NAKAMURA Takumi
29f8905caa DominatorTreeTest.cpp: Add the file header.
llvm-svn: 173233
2013-01-23 08:30:10 +00:00
Evgeniy Stepanov
044fd8aa94 Allow vectors in CreatePointerCast of constants.
llvm-svn: 172615
2013-01-16 14:41:46 +00:00
Evgeniy Stepanov
c6431b5743 A test for r172535.
llvm-svn: 172614
2013-01-16 14:38:50 +00:00
Dmitri Gribenko
521181bcca Improve r172464: const_cast is not needed if the variable is not const
llvm-svn: 172474
2013-01-14 21:23:37 +00:00
David Greene
6d59c943e8 Fix Casts
Use const_cast<> to avoid cast-away-const errors.

llvm-svn: 172464
2013-01-14 21:04:35 +00:00
Benjamin Kramer
de89fe30e0 Add a unit test to verifies that attribute uniquing works so it doesn't break again.
The folding set details can be subtle and broke twice in the last couple of weeks.

llvm-svn: 172313
2013-01-12 14:13:45 +00:00
Chandler Carruth
bcfdf656b1 Rename the VMCore unittest tree to IR. Somehow was missed when doing the
library rename.

llvm-svn: 171747
2013-01-07 15:35:46 +00:00