[llvm] r339197 - [NFC] adding tests for Y - (X + Y) --> -X
Michael Berg via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 7 15:52:57 PDT 2018
Author: mcberg2017
Date: Tue Aug 7 15:52:57 2018
New Revision: 339197
URL: http://llvm.org/viewvc/llvm-project?rev=339197&view=rev
Log:
[NFC] adding tests for Y - (X + Y) --> -X
Modified:
llvm/trunk/test/CodeGen/X86/fp-fold.ll
llvm/trunk/test/Transforms/InstCombine/fsub.ll
Modified: llvm/trunk/test/CodeGen/X86/fp-fold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fp-fold.ll?rev=339197&r1=339196&r2=339197&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fp-fold.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fp-fold.ll Tue Aug 7 15:52:57 2018
@@ -88,6 +88,19 @@ define float @fsub_neg_x_y(float %x, flo
ret float %r
}
+define float @fsub_neg_y(float %x, float %y) {
+; UNSAFE-LABEL: fsub_neg_y:
+; UNSAFE: # %bb.0:
+; UNSAFE-NEXT: mulss {{.*}}(%rip), %xmm0
+; UNSAFE-NEXT: subss %xmm1, %xmm0
+; UNSAFE-NEXT: addss %xmm1, %xmm0
+; UNSAFE-NEXT: retq
+ %mul = fmul float %x, 5.000000e+00
+ %add = fadd float %mul, %y
+ %r = fsub nsz reassoc float %y, %add
+ ret float %r
+}
+
define float @fsub_negzero(float %x) {
; STRICT-LABEL: fsub_negzero:
; STRICT: # %bb.0:
Modified: llvm/trunk/test/Transforms/InstCombine/fsub.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fsub.ll?rev=339197&r1=339196&r2=339197&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fsub.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fsub.ll Tue Aug 7 15:52:57 2018
@@ -60,6 +60,19 @@ define float @sub_sub_nsz(float %x, floa
ret float %t2
}
+; With nsz and reassoc: Y - (X + Y) --> -X
+define float @sub_add_neg_x(float %x, float %y) {
+; CHECK-LABEL: @sub_add_neg_x(
+; CHECK-NEXT: [[TMP1:%.*]] = fmul float [[X:%.*]], 5.000000e+00
+; CHECK-NEXT: [[T2:%.*]] = fsub reassoc nsz float -0.000000e+00, [[TMP1]]
+; CHECK-NEXT: ret float [[T2]]
+;
+ %mul = fmul float %x, 5.000000e+00
+ %add = fadd float %mul, %y
+ %r = fsub nsz reassoc float %y, %add
+ ret float %r
+}
+
; Same as above: if 'Z' is not -0.0, swap fsub operands and convert to fadd.
define float @sub_sub_known_not_negzero(float %x, float %y) {
More information about the llvm-commits
mailing list