[llvm] 778932c - [PowerPC] Turn deprecated altivec prefetch instrs to nops on AIX

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 27 13:50:10 PDT 2021


Author: Nemanja Ivanovic
Date: 2021-07-27T15:50:02-05:00
New Revision: 778932c673c28ce5fb75e551f1aa6bb5a542c563

URL: https://github.com/llvm/llvm-project/commit/778932c673c28ce5fb75e551f1aa6bb5a542c563
DIFF: https://github.com/llvm/llvm-project/commit/778932c673c28ce5fb75e551f1aa6bb5a542c563.diff

LOG: [PowerPC] Turn deprecated altivec prefetch instrs to nops on AIX

The dst/dstt/dstst/dststt instructions are nop's on all PowerPC
cores that AIX supports. The AIX assembler also does not accept
these mnemonics. Turn them into nop's on AIX (similar to dstall).

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
    llvm/test/CodeGen/PowerPC/2007-09-04-AltivecDST.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 5eac2cf52d388..d0109f9684462 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -2574,6 +2574,18 @@ void PPCAIXAsmPrinter::emitInstruction(const MachineInstr *MI) {
     if (MI->getOperand(0).isSymbol())
       report_fatal_error("Tail call for extern symbol not yet supported.");
     break;
+  case PPC::DST:
+  case PPC::DST64:
+  case PPC::DSTT:
+  case PPC::DSTT64:
+  case PPC::DSTST:
+  case PPC::DSTST64:
+  case PPC::DSTSTT:
+  case PPC::DSTSTT64:
+    EmitToStreamer(
+        *OutStreamer,
+        MCInstBuilder(PPC::ORI).addReg(PPC::R0).addReg(PPC::R0).addImm(0));
+    return;
   }
   return PPCAsmPrinter::emitInstruction(MI);
 }

diff  --git a/llvm/test/CodeGen/PowerPC/2007-09-04-AltivecDST.ll b/llvm/test/CodeGen/PowerPC/2007-09-04-AltivecDST.ll
index 25f069957f420..1dcb8ab101d54 100644
--- a/llvm/test/CodeGen/PowerPC/2007-09-04-AltivecDST.ll
+++ b/llvm/test/CodeGen/PowerPC/2007-09-04-AltivecDST.ll
@@ -1,6 +1,39 @@
-; RUN: llc -verify-machineinstrs < %s -mtriple=ppc64-- -mattr=+altivec | grep dst | count 4
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-- -mattr=+altivec | \
+; RUN:   FileCheck %s
+; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-aix- \
+; RUN:   -mattr=+altivec | FileCheck %s --check-prefix=AIX64
+; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-aix- -mattr=+altivec | \
+; RUN:   FileCheck %s --check-prefix=AIX32
+
 
 define hidden void @_Z4borkPc(i8* %image) {
+; CHECK-LABEL: _Z4borkPc:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    li 4, 8
+; CHECK-NEXT:    dst 3, 4, 0
+; CHECK-NEXT:    dstt 3, 4, 0
+; CHECK-NEXT:    dstst 3, 4, 0
+; CHECK-NEXT:    dststt 3, 4, 0
+; CHECK-NEXT:    blr
+;
+; AIX64-LABEL: _Z4borkPc:
+; AIX64:       # %bb.0: # %entry
+; AIX64-NEXT:    li 4, 8
+; AIX64-NEXT:    nop
+; AIX64-NEXT:    nop
+; AIX64-NEXT:    nop
+; AIX64-NEXT:    nop
+; AIX64-NEXT:    blr
+;
+; AIX32-LABEL: _Z4borkPc:
+; AIX32:       # %bb.0: # %entry
+; AIX32-NEXT:    li 4, 8
+; AIX32-NEXT:    nop
+; AIX32-NEXT:    nop
+; AIX32-NEXT:    nop
+; AIX32-NEXT:    nop
+; AIX32-NEXT:    blr
 entry:
 	tail call void @llvm.ppc.altivec.dst( i8* %image, i32 8, i32 0 )
 	tail call void @llvm.ppc.altivec.dstt( i8* %image, i32 8, i32 0 )


        


More information about the llvm-commits mailing list