Reland "[mips] Fix the target specific instruction verifier"
Fix an off by one error in the bounds checking for 'dinsu' and update
the ranges in the test comments so that they are accurate.
This version has the correct commit message.
Reviewers: atanasyan
Differential Revision: https://reviews.llvm.org/D41183
llvm-svn: 320991
diff --git a/llvm/test/CodeGen/Mips/fcopysign-f32-f64.ll b/llvm/test/CodeGen/Mips/fcopysign-f32-f64.ll
index 9ec2b8e..695431a 100644
--- a/llvm/test/CodeGen/Mips/fcopysign-f32-f64.ll
+++ b/llvm/test/CodeGen/Mips/fcopysign-f32-f64.ll
@@ -1,9 +1,9 @@
-; RUN: llc < %s -march=mips64el -mcpu=mips4 -target-abi=n64 | \
-; RUN: FileCheck %s -check-prefixes=ALL,64
-; RUN: llc < %s -march=mips64el -mcpu=mips64 -target-abi=n64 | \
-; RUN: FileCheck %s -check-prefixes=ALL,64
-; RUN: llc < %s -march=mips64el -mcpu=mips64r2 -target-abi=n64 | \
-; RUN: FileCheck %s -check-prefixes=ALL,64R2
+; RUN: llc < %s -verify-machineinstrs -march=mips64el -mcpu=mips4 \
+; RUN: -target-abi=n64 | FileCheck %s -check-prefixes=ALL,64
+; RUN: llc < %s -verify-machineinstrs -march=mips64el -mcpu=mips64 \
+; RUN: -target-abi=n64 | FileCheck %s -check-prefixes=ALL,64
+; RUN: llc < %s -verify-machineinstrs -march=mips64el -mcpu=mips64r2 \
+; RUN: -target-abi=n64 | FileCheck %s -check-prefixes=ALL,64R2
declare double @copysign(double, double) nounwind readnone
diff --git a/llvm/test/CodeGen/Mips/fcopysign.ll b/llvm/test/CodeGen/Mips/fcopysign.ll
index 9be876f2..810d0f9 100644
--- a/llvm/test/CodeGen/Mips/fcopysign.ll
+++ b/llvm/test/CodeGen/Mips/fcopysign.ll
@@ -1,8 +1,13 @@
-; RUN: llc < %s -march=mipsel -mcpu=mips32 | FileCheck %s -check-prefix=32
-; RUN: llc < %s -march=mipsel -mcpu=mips32r2 | FileCheck %s -check-prefix=32R2
-; RUN: llc < %s -march=mips64el -mcpu=mips4 -target-abi=n64 | FileCheck %s -check-prefix=64
-; RUN: llc < %s -march=mips64el -mcpu=mips64 -target-abi=n64 | FileCheck %s -check-prefix=64
-; RUN: llc < %s -march=mips64el -mcpu=mips64r2 -target-abi=n64 | FileCheck %s -check-prefix=64R2
+; RUN: llc < %s -verify-machineinstrs -march=mipsel -mcpu=mips32 \
+; RUN: | FileCheck %s -check-prefix=32
+; RUN: llc < %s -verify-machineinstrs -march=mipsel -mcpu=mips32r2 \
+; RUN: | FileCheck %s -check-prefix=32R2
+; RUN: llc < %s -verify-machineinstrs -march=mips64el -mcpu=mips4 -target-abi=n64 \
+; RUN: | FileCheck %s -check-prefix=64
+; RUN: llc < %s -verify-machineinstrs -march=mips64el -mcpu=mips64 -target-abi=n64 \
+; RUN: | FileCheck %s -check-prefix=64
+; RUN: llc < %s -verify-machineinstrs -march=mips64el -mcpu=mips64r2 -target-abi=n64 \
+; RUN: | FileCheck %s -check-prefix=64R2
define double @func0(double %d0, double %d1) nounwind readnone {
entry:
diff --git a/llvm/test/CodeGen/Mips/instverify/dext-pos.mir b/llvm/test/CodeGen/Mips/instverify/dext-pos.mir
index 5b57564..8e3b887 100644
--- a/llvm/test/CodeGen/Mips/instverify/dext-pos.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dext-pos.mir
@@ -3,7 +3,7 @@
# CHECK: Position operand is out of range!
-# Check that the machine verifier checks the position operand is in range 0..31
+# Check that the machine verifier checks the position operand is in the range 0..31
---
name: dext
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dext-size.mir b/llvm/test/CodeGen/Mips/instverify/dext-size.mir
index d643610..968dd4e3 100644
--- a/llvm/test/CodeGen/Mips/instverify/dext-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dext-size.mir
@@ -3,7 +3,7 @@
# CHECK: Size operand is out of range!
-# Check that the machine verifier checks the size operand is in range 0..32
+# Check that the machine verifier checks the size operand is in the range 1..32
---
name: dext
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dextm-pos-size.mir b/llvm/test/CodeGen/Mips/instverify/dextm-pos-size.mir
index eec459f..bdf82ec 100644
--- a/llvm/test/CodeGen/Mips/instverify/dextm-pos-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dextm-pos-size.mir
@@ -3,7 +3,7 @@
# CHECK: Position + Size is out of range!
-# Check that the machine verifier checks the pos + size is in range 32..64
+# Check that the machine verifier checks the pos + size is in the range 33..64
---
name: dextm
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dextm-pos.mir b/llvm/test/CodeGen/Mips/instverify/dextm-pos.mir
index 782d3fb..987a228 100644
--- a/llvm/test/CodeGen/Mips/instverify/dextm-pos.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dextm-pos.mir
@@ -3,7 +3,7 @@
# CHECK: Position operand is out of range!
-# Check that the machine verifier checks the position operand is in range 0..31
+# Check that the machine verifier checks the position operand is in the range 0..31
---
name: dextm
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dextm-size.mir b/llvm/test/CodeGen/Mips/instverify/dextm-size.mir
index 771abef..b1e367e 100644
--- a/llvm/test/CodeGen/Mips/instverify/dextm-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dextm-size.mir
@@ -3,7 +3,7 @@
# CHECK: Size operand is out of range!
-# Check that the machine verifier checks the size operand is in range 32..64
+# Check that the machine verifier checks the size operand is in the range 33..64
---
name: dextm
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dextu-pos-size.mir b/llvm/test/CodeGen/Mips/instverify/dextu-pos-size.mir
index 5356cf5..9b6dac0 100644
--- a/llvm/test/CodeGen/Mips/instverify/dextu-pos-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dextu-pos-size.mir
@@ -3,7 +3,7 @@
# CHECK: Position + Size is out of range!
-# Check that the machine verifier checks the pos + size is in range 32..64
+# Check that the machine verifier checks the pos + size is in the range 33..64
---
name: dextu
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dextu-pos.mir b/llvm/test/CodeGen/Mips/instverify/dextu-pos.mir
index 11b94c3..65e5bd0 100644
--- a/llvm/test/CodeGen/Mips/instverify/dextu-pos.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dextu-pos.mir
@@ -3,7 +3,7 @@
# CHECK: Position operand is out of range!
-# Check that the machine verifier checks the position operand is in range 32..63
+# Check that the machine verifier checks the position operand is in the range 32..63
---
name: dextu
alignment: 3
@@ -42,7 +42,7 @@
liveins: %a0_64
%0 = COPY %a0_64
- %1 = DEXTU %0, 65, 5
+ %1 = DEXTU %0, 64, 5
%v0_64 = COPY %1
RetRA implicit %v0_64
diff --git a/llvm/test/CodeGen/Mips/instverify/dextu-size-valid.mir b/llvm/test/CodeGen/Mips/instverify/dextu-size-valid.mir
new file mode 100644
index 0000000..8c548f1
--- /dev/null
+++ b/llvm/test/CodeGen/Mips/instverify/dextu-size-valid.mir
@@ -0,0 +1,49 @@
+# RUN: llc -march=mips64 -mcpu=mips64r2 -start-after=expand-isel-pseudos -stop-after=expand-isel-pseudos \
+# RUN: -verify-machineinstrs %s -o - 2>&1 | FileCheck %s
+
+# CHECK-NOT: Size operand is out of range!
+
+# Check that the machine verifier checks the size operand is in the range 1..32
+---
+name: dextu
+alignment: 3
+exposesReturnsTwice: false
+legalized: false
+regBankSelected: false
+selected: false
+tracksRegLiveness: true
+registers:
+ - { id: 0, class: gpr64, preferred-register: '' }
+ - { id: 1, class: gpr64, preferred-register: '' }
+liveins:
+ - { reg: '%a0_64', virtual-reg: '%0' }
+frameInfo:
+ isFrameAddressTaken: false
+ isReturnAddressTaken: false
+ hasStackMap: false
+ hasPatchPoint: false
+ stackSize: 0
+ offsetAdjustment: 0
+ maxAlignment: 1
+ adjustsStack: false
+ hasCalls: false
+ stackProtector: ''
+ maxCallFrameSize: 4294967295
+ hasOpaqueSPAdjustment: false
+ hasVAStart: false
+ hasMustTailInVarArgFunc: false
+ savePoint: ''
+ restorePoint: ''
+fixedStack:
+stack:
+constants:
+body: |
+ bb.0.entry:
+ liveins: %a0_64
+
+ %0 = COPY %a0_64
+ %1 = DEXTU %0, 63, 1
+ %v0_64 = COPY %1
+ RetRA implicit %v0_64
+
+...
diff --git a/llvm/test/CodeGen/Mips/instverify/dextu-size.mir b/llvm/test/CodeGen/Mips/instverify/dextu-size.mir
index 4efdd96..0511d1a 100644
--- a/llvm/test/CodeGen/Mips/instverify/dextu-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dextu-size.mir
@@ -3,7 +3,7 @@
# CHECK: Size operand is out of range!
-# Check that the machine verifier checks the size operand is in range 0..32
+# Check that the machine verifier checks the size operand is in the range 1..32
---
name: dextu
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dins-pos-size.mir b/llvm/test/CodeGen/Mips/instverify/dins-pos-size.mir
index 6276790..d1d1785 100644
--- a/llvm/test/CodeGen/Mips/instverify/dins-pos-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dins-pos-size.mir
@@ -3,7 +3,7 @@
# CHECK: Position + Size is out of range!
-# Check that the machine verifier checks the pos + size is in range 0..32
+# Check that the machine verifier checks the pos + size is in the range 1..32
---
name: dins
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dins-pos.mir b/llvm/test/CodeGen/Mips/instverify/dins-pos.mir
index fe61dea..1602aa2 100644
--- a/llvm/test/CodeGen/Mips/instverify/dins-pos.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dins-pos.mir
@@ -3,7 +3,7 @@
# CHECK: Position operand is out of range!
-# Check that the machine verifier checks the position operand is in range 0..31
+# Check that the machine verifier checks the position operand is in the range 0..31
---
name: dins
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dins-size.mir b/llvm/test/CodeGen/Mips/instverify/dins-size.mir
index 9fa0bc7..bf713bf 100644
--- a/llvm/test/CodeGen/Mips/instverify/dins-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dins-size.mir
@@ -3,7 +3,7 @@
# CHECK: Size operand is out of range!
-# Check that the machine verifier checks the size operand is in range 0..32
+# Check that the machine verifier checks the size operand is in the range 1..32
---
name: dins
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dinsm-pos-size.mir b/llvm/test/CodeGen/Mips/instverify/dinsm-pos-size.mir
index 450aa6a..aa73e7f 100644
--- a/llvm/test/CodeGen/Mips/instverify/dinsm-pos-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dinsm-pos-size.mir
@@ -3,7 +3,7 @@
# CHECK: Position + Size is out of range!
-# Check that the machine verifier checks the pos + size is in range 32..64
+# Check that the machine verifier checks the pos + size is in the range 33..64
---
name: dinsu
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dinsm-pos.mir b/llvm/test/CodeGen/Mips/instverify/dinsm-pos.mir
index 75bf00e..66a6053 100644
--- a/llvm/test/CodeGen/Mips/instverify/dinsm-pos.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dinsm-pos.mir
@@ -3,7 +3,7 @@
# CHECK: Position operand is out of range!
-# Check that the machine verifier checks the position operand is in range 0..31
+# Check that the machine verifier checks the position operand is in the range 0..31
---
name: dinsm
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dinsm-size.mir b/llvm/test/CodeGen/Mips/instverify/dinsm-size.mir
index 9b501d4..fba3bee 100644
--- a/llvm/test/CodeGen/Mips/instverify/dinsm-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dinsm-size.mir
@@ -3,7 +3,7 @@
# CHECK: Size operand is out of range!
-# Check that the machine verifier checks the size operand is in range 2..64
+# Check that the machine verifier checks the size operand is in the range 2..64
---
name: dinsm
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dinsu-pos-size.mir b/llvm/test/CodeGen/Mips/instverify/dinsu-pos-size.mir
index 51a5304..9d2d17c 100644
--- a/llvm/test/CodeGen/Mips/instverify/dinsu-pos-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dinsu-pos-size.mir
@@ -3,7 +3,7 @@
# CHECK: Position + Size is out of range!
-# Check that the machine verifier checks the pos + size is in range 32..64
+# Check that the machine verifier checks the pos + size is in the range 33..64
---
name: dinsu
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dinsu-pos.mir b/llvm/test/CodeGen/Mips/instverify/dinsu-pos.mir
index cbfae68..d89bb2d 100644
--- a/llvm/test/CodeGen/Mips/instverify/dinsu-pos.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dinsu-pos.mir
@@ -3,7 +3,7 @@
# CHECK: Position operand is out of range!
-# Check that the machine verifier checks the position operand is in range 32..63
+# Check that the machine verifier checks the position operand is in the range 32..63
---
name: dinsu
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/dinsu-size.mir b/llvm/test/CodeGen/Mips/instverify/dinsu-size.mir
index 048a6f0..550f890 100644
--- a/llvm/test/CodeGen/Mips/instverify/dinsu-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/dinsu-size.mir
@@ -3,7 +3,7 @@
# CHECK: Size operand is out of range!
-# Check that the machine verifier checks the size operand is in range 0..32
+# Check that the machine verifier checks the size operand is in the range 1..32
---
name: dinsu
alignment: 3
diff --git a/llvm/test/CodeGen/Mips/instverify/ext-pos-size.mir b/llvm/test/CodeGen/Mips/instverify/ext-pos-size.mir
index c230331..94edecd 100644
--- a/llvm/test/CodeGen/Mips/instverify/ext-pos-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/ext-pos-size.mir
@@ -3,7 +3,7 @@
# CHECK: Position + Size is out of range!
-# Check that the machine verifier checks the pos + size is in range 0..32
+# Check that the machine verifier checks the pos + size is in the range 1..32
---
name: f
alignment: 2
diff --git a/llvm/test/CodeGen/Mips/instverify/ext-pos.mir b/llvm/test/CodeGen/Mips/instverify/ext-pos.mir
index ce472db..7cca1b6 100644
--- a/llvm/test/CodeGen/Mips/instverify/ext-pos.mir
+++ b/llvm/test/CodeGen/Mips/instverify/ext-pos.mir
@@ -3,7 +3,7 @@
# CHECK: Position operand is out of range!
-# Check that the machine verifier checks the position operand is in range 0..31
+# Check that the machine verifier checks the position operand is in the range 0..31
---
name: f
alignment: 2
diff --git a/llvm/test/CodeGen/Mips/instverify/ext-size.mir b/llvm/test/CodeGen/Mips/instverify/ext-size.mir
index 00f7182..4c35e1f 100644
--- a/llvm/test/CodeGen/Mips/instverify/ext-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/ext-size.mir
@@ -3,7 +3,7 @@
# CHECK: Size operand is out of range!
-# Check that the machine verifier checks the size operand is in range 0..32
+# Check that the machine verifier checks the size operand is in the range 1..32
---
name: f
alignment: 2
diff --git a/llvm/test/CodeGen/Mips/instverify/ins-pos-size.mir b/llvm/test/CodeGen/Mips/instverify/ins-pos-size.mir
index 9587236..e825b59 100644
--- a/llvm/test/CodeGen/Mips/instverify/ins-pos-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/ins-pos-size.mir
@@ -3,7 +3,7 @@
# CHECK: Position + Size is out of range!
-# Check that the machine verifier checks the pos + size is in range 0..32
+# Check that the machine verifier checks the pos + size is in the range 1..32
---
name: f
alignment: 2
diff --git a/llvm/test/CodeGen/Mips/instverify/ins-pos.mir b/llvm/test/CodeGen/Mips/instverify/ins-pos.mir
index c8811ed..a284fdb 100644
--- a/llvm/test/CodeGen/Mips/instverify/ins-pos.mir
+++ b/llvm/test/CodeGen/Mips/instverify/ins-pos.mir
@@ -3,7 +3,7 @@
# CHECK: Position operand is out of range!
-# Check that the machine verifier checks the position operand is in range 0..31
+# Check that the machine verifier checks the position operand is in the range 0..31
---
name: f
alignment: 2
diff --git a/llvm/test/CodeGen/Mips/instverify/ins-size.mir b/llvm/test/CodeGen/Mips/instverify/ins-size.mir
index fba2521..6cd839a 100644
--- a/llvm/test/CodeGen/Mips/instverify/ins-size.mir
+++ b/llvm/test/CodeGen/Mips/instverify/ins-size.mir
@@ -3,7 +3,7 @@
# CHECK: Size operand is out of range!
-# Check that the machine verifier checks the size operand is in range 0..32
+# Check that the machine verifier checks the size operand is in the range 1..32
---
name: f
alignment: 2