[PATCH] D150899: [PowerPC] Add DFP compare instructions.

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 12:09:15 PDT 2023


stefanp created this revision.
stefanp added reviewers: nemanjai, lei, amyk.
Herald added subscribers: shchenz, kbarton, hiraditya.
Herald added a project: All.
stefanp requested review of this revision.
Herald added a project: LLVM.

This patch adds the DFP compare instructions:
dcmpu, dcmpuq, dcmpo, dcmpoq


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150899

Files:
  llvm/lib/Target/PowerPC/PPCInstrDFP.td
  llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-dfp.txt
  llvm/test/MC/PowerPC/ppc64-encoding-dfp.s


Index: llvm/test/MC/PowerPC/ppc64-encoding-dfp.s
===================================================================
--- llvm/test/MC/PowerPC/ppc64-encoding-dfp.s
+++ llvm/test/MC/PowerPC/ppc64-encoding-dfp.s
@@ -50,3 +50,15 @@
 # CHECK-BE: ddivq. 2, 6, 4                 # encoding: [0xfc,0x46,0x24,0x45]
 # CHECK-LE: ddivq. 2, 6, 4                 # encoding: [0x45,0x24,0x46,0xfc]
             ddivq. 2, 6, 4
+# CHECK-BE: dcmpu 2, 6, 4                  # encoding: [0xed,0x06,0x25,0x04]
+# CHECK-LE: dcmpu 2, 6, 4                  # encoding: [0x04,0x25,0x06,0xed]
+            dcmpu 2, 6, 4
+# CHECK-BE: dcmpuq 2, 6, 4                 # encoding: [0xfd,0x06,0x25,0x04]
+# CHECK-LE: dcmpuq 2, 6, 4                 # encoding: [0x04,0x25,0x06,0xfd]
+            dcmpuq 2, 6, 4
+# CHECK-BE: dcmpo 2, 6, 4                  # encoding: [0xed,0x06,0x21,0x04]
+# CHECK-LE: dcmpo 2, 6, 4                  # encoding: [0x04,0x21,0x06,0xed]
+            dcmpo 2, 6, 4
+# CHECK-BE: dcmpoq 2, 6, 4                 # encoding: [0xfd,0x06,0x21,0x04]
+# CHECK-LE: dcmpoq 2, 6, 4                 # encoding: [0x04,0x21,0x06,0xfd]
+            dcmpoq 2, 6, 4
Index: llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-dfp.txt
===================================================================
--- llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-dfp.txt
+++ llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-dfp.txt
@@ -47,3 +47,15 @@
 
 # CHECK: ddivq. 2, 6, 4
 0xfc 0x46 0x24 0x45
+
+# CHECK: dcmpu 2, 6, 4
+0xed 0x06 0x25 0x04
+
+# CHECK: dcmpuq 2, 6, 4
+0xfd 0x06 0x25 0x04
+
+# CHECK: dcmpo 2, 6, 4
+0xed 0x06 0x21 0x04
+
+# CHECK: dcmpoq 2, 6, 4
+0xfd 0x06 0x21 0x04
Index: llvm/lib/Target/PowerPC/PPCInstrDFP.td
===================================================================
--- llvm/lib/Target/PowerPC/PPCInstrDFP.td
+++ llvm/lib/Target/PowerPC/PPCInstrDFP.td
@@ -36,5 +36,20 @@
 
 defm DDIVQ : XForm_28r<63, 546, (outs fpairrc:$RST), (ins fpairrc:$RA, fpairrc:$RB),
                        "ddivq",  "$RST, $RA, $RB", IIC_FPGeneral, []>;
+
+let isCompare = 1, mayRaiseFPException = 1 in {
+  def DCMPU : XForm_17<59, 642, (outs crrc:$BF), (ins f8rc:$RA, f8rc:$RB),
+                       "dcmpu $BF, $RA, $RB", IIC_FPCompare>;
+
+  def DCMPUQ : XForm_17<63, 642, (outs crrc:$BF), (ins fpairrc:$RA, fpairrc:$RB),
+                        "dcmpuq $BF, $RA, $RB", IIC_FPCompare>;
+
+  def DCMPO : XForm_17<59, 130, (outs crrc:$BF), (ins f8rc:$RA, f8rc:$RB),
+                       "dcmpo $BF, $RA, $RB", IIC_FPCompare>;
+
+  def DCMPOQ : XForm_17<63, 130, (outs crrc:$BF), (ins fpairrc:$RA, fpairrc:$RB),
+                        "dcmpoq $BF, $RA, $RB", IIC_FPCompare>;
+}
+
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150899.523498.patch
Type: text/x-patch
Size: 2677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230518/b147a122/attachment.bin>


More information about the llvm-commits mailing list