[PATCH] D150287: [Hexagon] Flip subreg bit for reverse pairs hvx .new

Alexey Karyakin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 12:05:07 PDT 2023


quic-akaryaki updated this revision to Diff 521067.
quic-akaryaki added a comment.
This revision is now accepted and ready to land.

Add explicit version to objdump.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150287

Files:
  llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
  llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
  llvm/test/MC/Hexagon/hvx-nv-pair-reverse.s


Index: llvm/test/MC/Hexagon/hvx-nv-pair-reverse.s
===================================================================
--- /dev/null
+++ llvm/test/MC/Hexagon/hvx-nv-pair-reverse.s
@@ -0,0 +1,18 @@
+# RUN: llvm-mc -arch=hexagon -mv69 -mhvx -filetype=obj %s | \
+# RUN:   llvm-objdump --arch=hexagon --mcpu=hexagonv69 --mattr=+hvx -d - | \
+# RUN:   FileCheck %s
+# CHECK: 00000000 <.text>:
+
+{
+  V4:5.w = vadd(V1:0.w, V3:2.w)
+  vmem(r0+#0) = v4.new
+}
+# CHECK-NEXT: 1c6240c5 { 	v4:5.w = vadd(v1:0.w,v3:2.w)
+# CHECK-NEXT: 2820c023   	vmem(r0+#0x0) = v4.new }
+
+{
+  V4:5.w = vadd(V1:0.w, V3:2.w)
+  vmem(r0+#0) = v5.new
+}
+# CHECK-NEXT: 1c6240c5 { 	v4:5.w = vadd(v1:0.w,v3:2.w)
+# CHECK-NEXT: 2820c022   	vmem(r0+#0x0) = v5.new }
Index: llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
===================================================================
--- llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
+++ llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
@@ -1028,8 +1028,10 @@
                                             unsigned Producer2) {
   // If we're a single vector consumer of a double producer, set subreg bit
   // based on if we're accessing the lower or upper register component
-  if (IsVecRegPair(Producer) && IsVecRegSingle(Consumer))
-    return (Consumer - Hexagon::V0) & 0x1;
+  if (IsVecRegPair(Producer) && IsVecRegSingle(Consumer)) {
+    unsigned Rev = IsReverseVecRegPair(Producer);
+    return ((Consumer - Hexagon::V0) & 0x1) ^ Rev;
+  }
   if (Producer2 != Hexagon::NoRegister)
     return Consumer == Producer;
   return 0;
Index: llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
===================================================================
--- llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
+++ llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
@@ -512,6 +512,8 @@
         const bool Rev = HexagonMCInstrInfo::IsReverseVecRegPair(Producer);
         const unsigned ProdPairIndex =
             Rev ? Producer - Hexagon::WR0 : Producer - Hexagon::W0;
+        if (Rev)
+          SubregBit = !SubregBit;
         Producer = (ProdPairIndex << 1) + SubregBit + Hexagon::V0;
       } else if (SubregBit)
         // Hexagon PRM 10.11 New-value operands


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150287.521067.patch
Type: text/x-patch
Size: 2267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230510/96c5c917/attachment.bin>


More information about the llvm-commits mailing list