diff options
author | Cameron McInally <cameron.mcinally@nyu.edu> | 2018-11-13 18:15:47 +0000 |
---|---|---|
committer | Cameron McInally <cameron.mcinally@nyu.edu> | 2018-11-13 18:15:47 +0000 |
commit | cbde0d9c7be1991751dc3eb5928294d2e00ef26a (patch) | |
tree | ad839084df9863182687fadb95471920cb15381b /llvm/test/Bitcode | |
parent | 9d87256d3de67f7a2e8f778ee775e0b6bb309aeb (diff) | |
download | bcm5719-llvm-cbde0d9c7be1991751dc3eb5928294d2e00ef26a.tar.gz bcm5719-llvm-cbde0d9c7be1991751dc3eb5928294d2e00ef26a.zip |
[IR] Add a dedicated FNeg IR Instruction
The IEEE-754 Standard makes it clear that fneg(x) and
fsub(-0.0, x) are two different operations. The former is a bitwise
operation, while the latter is an arithmetic operation. This patch
creates a dedicated FNeg IR Instruction to model that behavior.
Differential Revision: https://reviews.llvm.org/D53877
llvm-svn: 346774
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r-- | llvm/test/Bitcode/compatibility.ll | 29 | ||||
-rw-r--r-- | llvm/test/Bitcode/function-encoding-rel-operands.ll | 9 |
2 files changed, 37 insertions, 1 deletions
diff --git a/llvm/test/Bitcode/compatibility.ll b/llvm/test/Bitcode/compatibility.ll index 8c0471a1134..1d57f759391 100644 --- a/llvm/test/Bitcode/compatibility.ll +++ b/llvm/test/Bitcode/compatibility.ll @@ -762,7 +762,27 @@ define void @atomics(i32* %word) { } ;; Fast Math Flags -define void @fastmathflags(float %op1, float %op2) { +define void @fastmathflags_unop(float %op1) { + %f.nnan = fneg nnan float %op1 + ; CHECK: %f.nnan = fneg nnan float %op1 + %f.ninf = fneg ninf float %op1 + ; CHECK: %f.ninf = fneg ninf float %op1 + %f.nsz = fneg nsz float %op1 + ; CHECK: %f.nsz = fneg nsz float %op1 + %f.arcp = fneg arcp float %op1 + ; CHECK: %f.arcp = fneg arcp float %op1 + %f.contract = fneg contract float %op1 + ; CHECK: %f.contract = fneg contract float %op1 + %f.afn = fneg afn float %op1 + ; CHECK: %f.afn = fneg afn float %op1 + %f.reassoc = fneg reassoc float %op1 + ; CHECK: %f.reassoc = fneg reassoc float %op1 + %f.fast = fneg fast float %op1 + ; CHECK: %f.fast = fneg fast float %op1 + ret void +} + +define void @fastmathflags_binops(float %op1, float %op2) { %f.nnan = fadd nnan float %op1, %op2 ; CHECK: %f.nnan = fadd nnan float %op1, %op2 %f.ninf = fadd ninf float %op1, %op2 @@ -997,6 +1017,13 @@ continue: ret i32 0 } +; Instructions -- Unary Operations +define void @instructions.unops(double %op1) { + fneg double %op1 + ; CHECK: fneg double %op1 + ret void +} + ; Instructions -- Binary Operations define void @instructions.binops(i8 %op1, i8 %op2) { ; nuw x nsw diff --git a/llvm/test/Bitcode/function-encoding-rel-operands.ll b/llvm/test/Bitcode/function-encoding-rel-operands.ll index 1307dd48337..9486e04a0d5 100644 --- a/llvm/test/Bitcode/function-encoding-rel-operands.ll +++ b/llvm/test/Bitcode/function-encoding-rel-operands.ll @@ -4,6 +4,15 @@ ; RUN: verify-uselistorder < %s ; CHECK: FUNCTION_BLOCK +; CHECK: INST_UNOP {{.*}}op0=1 +; CHECK: INST_RET {{.*}}op0=1 +define double @test_float_unops(double %a) nounwind { + %1 = fneg double %a + ret double %1 +} + + +; CHECK: FUNCTION_BLOCK ; CHECK: INST_BINOP {{.*}}op0=1 op1=1 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1 |