[PATCH] D86489: [PowerPC] Add addtional test that retroactively catches PR47259

Brandon Bergren via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 14:42:20 PDT 2020


Bdragon28 created this revision.
Bdragon28 added reviewers: hans, ZhangKang.
Bdragon28 added a project: LLVM.
Herald added subscribers: llvm-commits, shchenz, kbarton, nemanjai.
Bdragon28 requested review of this revision.
Herald added a subscriber: wuzish.

Due to the unfortunate way the bug could only be triggered when reading SPRG[0-3] into a register lower than %r4 with the "mfrprg %rX, 0" syntax, the tests did not detect it.

(It could not be triggered for "mfsprg0, %r2" because that pattern was already in the table, so the earlier "correct" match took effect)

As a canary, add an intentionally ambiguous "mfsprg 2, 2" and "mtsprg 2, 2" check that would have caught the problem.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86489

Files:
  llvm/test/MC/PowerPC/ppc64-encoding-ext.s


Index: llvm/test/MC/PowerPC/ppc64-encoding-ext.s
===================================================================
--- llvm/test/MC/PowerPC/ppc64-encoding-ext.s
+++ llvm/test/MC/PowerPC/ppc64-encoding-ext.s
@@ -3571,6 +3571,11 @@
 # CHECK-LE: mfspr 4, 275                    # encoding: [0xa6,0x42,0x93,0x7c]
             mfsprg %r4, 3
 
+# Bug PR47259
+# CHECK-BE: mfspr 2, 274                    # encoding: [0x7c,0x52,0x42,0xa6]
+# CHECK-LE: mfspr 2, 274                    # encoding: [0xa6,0x42,0x52,0x7c]
+            mfsprg 2, 2
+
 # CHECK-BE: mfspr 2, 272                    # encoding: [0x7c,0x50,0x42,0xa6]
 # CHECK-LE: mfspr 2, 272                    # encoding: [0xa6,0x42,0x50,0x7c]
             mfsprg0 %r2
@@ -3600,6 +3605,11 @@
 # CHECK-LE: mtspr 275, 4                    # encoding: [0xa6,0x43,0x93,0x7c]
             mtsprg 3, %r4
 
+# Bug PR47259
+# CHECK-BE: mtspr 274, 2                    # encoding: [0x7c,0x52,0x43,0xa6]
+# CHECK-LE: mtspr 274, 2                    # encoding: [0xa6,0x43,0x52,0x7c]
+            mtsprg 2, 2
+
 # CHECK-BE: mtspr 272, 4                    # encoding: [0x7c,0x90,0x43,0xa6]
 # CHECK-LE: mtspr 272, 4                    # encoding: [0xa6,0x43,0x90,0x7c]
             mtsprg0 %r4


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86489.287491.patch
Type: text/x-patch
Size: 1237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200824/98cda5f7/attachment.bin>


More information about the llvm-commits mailing list