[llvm-branch-commits] [llvm] f07b95e - [PowerPC] Add addtional test that retroactively catches PR47259

Brandon Bergren via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 30 13:28:32 PST 2020


Author: Brandon Bergren
Date: 2020-12-30T15:23:48-06:00
New Revision: f07b95e8bcd1584167eaa8bd41ef8ee96422df65

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

LOG: [PowerPC] Add addtional test that retroactively catches PR47259

Due to the unfortunate way the bug could only be triggered when reading SPRG[0-3] into a register lower than %r4 with the "mfsprg %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.

Reviewed By: ZhangKang

Differential Revision: https://reviews.llvm.org/D86489

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/MC/PowerPC/ppc64-encoding-ext.s b/llvm/test/MC/PowerPC/ppc64-encoding-ext.s
index 6284ca0efb09..6edad4c31bed 100644
--- a/llvm/test/MC/PowerPC/ppc64-encoding-ext.s
+++ b/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


        


More information about the llvm-branch-commits mailing list