[PATCH] D67595: [PowerPC] Add missing pattern for VSX Scalar Negative Multiply-Subtract Single Precision

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 08:16:27 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372985: [PowerPC] Add missing pattern for VSX Scalar Negative Multiply-Subtract Singleā€¦ (authored by jsji, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D67595?vs=221955&id=221958#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67595/new/

https://reviews.llvm.org/D67595

Files:
  llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td
  llvm/trunk/test/CodeGen/PowerPC/fdiv.ll


Index: llvm/trunk/test/CodeGen/PowerPC/fdiv.ll
===================================================================
--- llvm/trunk/test/CodeGen/PowerPC/fdiv.ll
+++ llvm/trunk/test/CodeGen/PowerPC/fdiv.ll
@@ -5,9 +5,8 @@
 ; CHECK-LABEL: foo:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    xsresp 3, 2
-; CHECK-NEXT:    fneg 2, 2
 ; CHECK-NEXT:    xsmulsp 0, 1, 3
-; CHECK-NEXT:    xsmaddasp 1, 2, 0
+; CHECK-NEXT:    xsnmsubasp 1, 2, 0
 ; CHECK-NEXT:    xsmaddasp 0, 3, 1
 ; CHECK-NEXT:    fmr 1, 0
 ; CHECK-NEXT:    blr
Index: llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td
===================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td
@@ -1512,6 +1512,12 @@
                           AltVSXFMARel;
   }
 
+  // Additional xsnmsubasp patterns: -a*b + c == -(a*b - c)
+  def : Pat<(fma (fneg f32:$A), f32:$B, f32:$C),
+            (XSNMSUBASP $C, $A, $B)>;
+  def : Pat<(fma f32:$A, (fneg f32:$C), f32:$B),
+            (XSNMSUBASP $C, $A, $B)>;
+
   // Single Precision Conversions (FP <-> INT)
   def XSCVSXDSP : XX2Form<60, 312,
                       (outs vssrc:$XT), (ins vsfrc:$XB),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67595.221958.patch
Type: text/x-patch
Size: 1187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190926/21f1ce8e/attachment.bin>


More information about the llvm-commits mailing list