[PATCH] D106666: [PowerPC]Add addex instruction definition and MC tests

Lei Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 26 12:55:49 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG64a15817a017: [PowerPC]Add addex instruction definition and MC tests (authored by lei).

Changed prior to commit:
  https://reviews.llvm.org/D106666?vs=361201&id=361767#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106666

Files:
  llvm/lib/Target/PowerPC/P9InstrResources.td
  llvm/lib/Target/PowerPC/PPCInstrFormats.td
  llvm/lib/Target/PowerPC/PPCInstrInfo.td
  llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt
  llvm/test/MC/Disassembler/PowerPC/ppc64le-encoding.txt
  llvm/test/MC/PowerPC/ppc64-encoding.s


Index: llvm/test/MC/PowerPC/ppc64-encoding.s
===================================================================
--- llvm/test/MC/PowerPC/ppc64-encoding.s
+++ llvm/test/MC/PowerPC/ppc64-encoding.s
@@ -416,6 +416,9 @@
 # CHECK-BE: addeo. 2, 3, 4                  # encoding: [0x7c,0x43,0x25,0x15]
 # CHECK-LE: addeo. 2, 3, 4                  # encoding: [0x15,0x25,0x43,0x7c]
             addeo. 2, 3, 4
+# CHECK-BE: addex 2, 4, 5, 0                # encoding: [0x7c,0x44,0x29,0x54]
+# CHECK-LE: addex 2, 4, 5, 0                # encoding: [0x54,0x29,0x44,0x7c]
+            addex 2, 4, 5, 0
 # CHECK-BE: subfe 2, 3, 4                   # encoding: [0x7c,0x43,0x21,0x10]
 # CHECK-LE: subfe 2, 3, 4                   # encoding: [0x10,0x21,0x43,0x7c]
             subfe 2, 3, 4
Index: llvm/test/MC/Disassembler/PowerPC/ppc64le-encoding.txt
===================================================================
--- llvm/test/MC/Disassembler/PowerPC/ppc64le-encoding.txt
+++ llvm/test/MC/Disassembler/PowerPC/ppc64le-encoding.txt
@@ -448,6 +448,9 @@
 # CHECK: modsw 2, 3, 4
 0x16 0x26 0x43 0x7c
 
+# CHECK: addex 2, 4, 5, 0
+0x54 0x29 0x44 0x7C
+
 # CHECK: moduw 2, 3, 4
 0x16 0x22 0x43 0x7c
 
Index: llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt
===================================================================
--- llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt
+++ llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt
@@ -484,6 +484,9 @@
 # CHECK: modsw 2, 3, 4
 0x7c 0x43 0x26 0x16
 
+# CHECK: addex 2, 4, 5, 0
+0x7C 0x44 0x29 0x54
+
 # CHECK: moduw 2, 3, 4
 0x7c 0x43 0x22 0x16
 
Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td
===================================================================
--- llvm/lib/Target/PowerPC/PPCInstrInfo.td
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.td
@@ -3155,6 +3155,10 @@
 def MODUW : XForm_8<31, 267, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
                         "moduw $rT, $rA, $rB", IIC_IntDivW,
                         [(set i32:$rT, (urem i32:$rA, i32:$rB))]>;
+let hasSideEffects = 1 in
+def ADDEX : Z23Form_RTAB5_CY2<31, 170, (outs gprc:$rT),
+                              (ins gprc:$rA, gprc:$rB, u2imm:$CY),
+                              "addex $rT, $rA, $rB, $CY", IIC_IntGeneral, []>;
 }
 
 let PPC970_Unit = 1, hasSideEffects = 0 in {  // FXU Operations.
Index: llvm/lib/Target/PowerPC/PPCInstrFormats.td
===================================================================
--- llvm/lib/Target/PowerPC/PPCInstrFormats.td
+++ llvm/lib/Target/PowerPC/PPCInstrFormats.td
@@ -2141,6 +2141,24 @@
   let Inst{31}    = RC;
 }
 
+class Z23Form_RTAB5_CY2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
+                        string asmstr, InstrItinClass itin, list<dag> pattern>
+         : I<opcode, OOL, IOL, asmstr, itin> {
+  bits<5> RT;
+  bits<5> RA;
+  bits<5> RB;
+  bits<2> CY;
+
+  let Pattern = pattern;
+
+  let Inst{6-10}  = RT;
+  let Inst{11-15} = RA;
+  let Inst{16-20} = RB;
+  let Inst{21-22} = CY;
+  let Inst{23-30} = xo;
+  let Inst{31} = 0;
+}
+
 //===----------------------------------------------------------------------===//
 // EmitTimePseudo won't have encoding information for the [MC]CodeEmitter
 // stuff
Index: llvm/lib/Target/PowerPC/P9InstrResources.td
===================================================================
--- llvm/lib/Target/PowerPC/P9InstrResources.td
+++ llvm/lib/Target/PowerPC/P9InstrResources.td
@@ -1429,5 +1429,6 @@
   DCBA,
   DCBI,
   DCCCI,
-  ICCCI
+  ICCCI,
+  ADDEX
 )> { let Unsupported = 1; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106666.361767.patch
Type: text/x-patch
Size: 3519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210726/e2c67816/attachment.bin>


More information about the llvm-commits mailing list