diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-05-22 15:50:46 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-05-22 15:50:46 +0000 |
commit | 5a4f7cf2ff3fc15d82ca062ee64dd8bd01a68883 (patch) | |
tree | 6fb5af1a3e04d75d44d0a65c713d4042cf37a445 /llvm/test/Bitcode | |
parent | 63305c8fbba7b3b852f43fb2e05b9752097f13ba (diff) | |
download | bcm5719-llvm-5a4f7cf2ff3fc15d82ca062ee64dd8bd01a68883.tar.gz bcm5719-llvm-5a4f7cf2ff3fc15d82ca062ee64dd8bd01a68883.zip |
[IR] allow fast-math-flags on select of FP values
This is a minimal start to correcting a problem most directly discussed in PR38086:
https://bugs.llvm.org/show_bug.cgi?id=38086
We have been hacking around a limitation for FP select patterns by using the
fast-math-flags on the condition of the select rather than the select itself.
This patch just allows FMF to appear with the 'select' opcode. No changes are
needed to "FPMathOperator" because it already includes select-of-FP because
that definition is based on the (return) value type.
Once we have this ability, we can start correcting and adding IR transforms
to use the FMF on a 'select' instruction. The instcombine and vectorizer test
diffs only show that the IRBuilder change is behaving as expected by applying
an FMF guard value to 'select'.
For reference:
rL241901 - allowed FMF with fcmp
rL255555 - allowed FMF with FP calls
Differential Revision: https://reviews.llvm.org/D61917
llvm-svn: 361401
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r-- | llvm/test/Bitcode/compatibility.ll | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/compatibility.ll b/llvm/test/Bitcode/compatibility.ll index 95cd49f8156..a1474df6d94 100644 --- a/llvm/test/Bitcode/compatibility.ll +++ b/llvm/test/Bitcode/compatibility.ll @@ -815,6 +815,34 @@ define void @fastmathflags_binops(float %op1, float %op2) { ret void } +define void @fastmathflags_select(i1 %cond, float %op1, float %op2) { + %f.nnan = select nnan i1 %cond, float %op1, float %op2 + ; CHECK: %f.nnan = select nnan i1 %cond, float %op1, float %op2 + %f.ninf = select ninf i1 %cond, float %op1, float %op2 + ; CHECK: %f.ninf = select ninf i1 %cond, float %op1, float %op2 + %f.nsz = select nsz i1 %cond, float %op1, float %op2 + ; CHECK: %f.nsz = select nsz i1 %cond, float %op1, float %op2 + %f.arcp = select arcp i1 %cond, float %op1, float %op2 + ; CHECK: %f.arcp = select arcp i1 %cond, float %op1, float %op2 + %f.contract = select contract i1 %cond, float %op1, float %op2 + ; CHECK: %f.contract = select contract i1 %cond, float %op1, float %op2 + %f.afn = select afn i1 %cond, float %op1, float %op2 + ; CHECK: %f.afn = select afn i1 %cond, float %op1, float %op2 + %f.reassoc = select reassoc i1 %cond, float %op1, float %op2 + ; CHECK: %f.reassoc = select reassoc i1 %cond, float %op1, float %op2 + %f.fast = select fast i1 %cond, float %op1, float %op2 + ; CHECK: %f.fast = select fast i1 %cond, float %op1, float %op2 + ret void +} + +define void @fastmathflags_vector_select(<2 x i1> %cond, <2 x double> %op1, <2 x double> %op2) { + %f.nnan.nsz = select nnan nsz <2 x i1> %cond, <2 x double> %op1, <2 x double> %op2 + ; CHECK: %f.nnan.nsz = select nnan nsz <2 x i1> %cond, <2 x double> %op1, <2 x double> %op2 + %f.fast = select fast <2 x i1> %cond, <2 x double> %op1, <2 x double> %op2 + ; CHECK: %f.fast = select fast <2 x i1> %cond, <2 x double> %op1, <2 x double> %op2 + ret void +} + ; Check various fast math flags and floating-point types on calls. declare float @fmf1() |