[llvm] r339300 - [x86] add test for commuted variant for fsub fold; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 8 16:06:59 PDT 2018
Author: spatel
Date: Wed Aug 8 16:06:59 2018
New Revision: 339300
URL: http://llvm.org/viewvc/llvm-project?rev=339300&view=rev
Log:
[x86] add test for commuted variant for fsub fold; NFC
Modified:
llvm/trunk/test/CodeGen/X86/fp-fold.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=339300&r1=339299&r2=339300&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fp-fold.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fp-fold.ll Wed Aug 8 16:06:59 2018
@@ -103,13 +103,32 @@ define float @fsub_neg_y(float %x, float
; UNSAFE-NEXT: subss %xmm1, %xmm0
; UNSAFE-NEXT: addss %xmm1, %xmm0
; UNSAFE-NEXT: retq
- %mul = fmul float %x, 5.000000e+00
+ %mul = fmul float %x, 5.0
%add = fadd float %mul, %y
%r = fsub nsz reassoc float %y, %add
ret float %r
}
-; Test node-level flags with:
+define float @fsub_neg_y_commute(float %x, float %y) {
+; STRICT-LABEL: fsub_neg_y_commute:
+; STRICT: # %bb.0:
+; STRICT-NEXT: mulss {{.*}}(%rip), %xmm0
+; STRICT-NEXT: addss %xmm1, %xmm0
+; STRICT-NEXT: subss %xmm0, %xmm1
+; STRICT-NEXT: movaps %xmm1, %xmm0
+; STRICT-NEXT: retq
+;
+; UNSAFE-LABEL: fsub_neg_y_commute:
+; 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.0
+ %add = fadd float %y, %mul
+ %r = fsub nsz reassoc float %y, %add
+ ret float %r
+}
; Y - (X + Y) --> -X
define float @fsub_fadd_common_op_fneg(float %x, float %y) {
More information about the llvm-commits
mailing list