[llvm] r204796 - [mips] The register names depend on the ABI being N32/N64 rather than the arch being mips64
Daniel Sanders
daniel.sanders at imgtec.com
Wed Mar 26 04:39:08 PDT 2014
Author: dsanders
Date: Wed Mar 26 06:39:07 2014
New Revision: 204796
URL: http://llvm.org/viewvc/llvm-project?rev=204796&view=rev
Log:
[mips] The register names depend on the ABI being N32/N64 rather than the arch being mips64
Summary: Added test cases for O32 and N32 on MIPS64.
Reviewers: matheusalmeida
Reviewed By: matheusalmeida
Differential Revision: http://llvm-reviews.chandlerc.com/D3175
Added:
llvm/trunk/test/MC/Mips/mips-register-names-o32.s
- copied, changed from r204793, llvm/trunk/test/MC/Mips/mips-register-names.s
llvm/trunk/test/MC/Mips/mips64-register-names-n32-n64.s
- copied, changed from r204793, llvm/trunk/test/MC/Mips/mips64-register-names.s
llvm/trunk/test/MC/Mips/mips64-register-names-o32.s
Removed:
llvm/trunk/test/MC/Mips/mips-register-names.s
llvm/trunk/test/MC/Mips/mips64-register-names.s
Modified:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=204796&r1=204795&r2=204796&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Wed Mar 26 06:39:07 2014
@@ -222,6 +222,7 @@ class MipsAsmParser : public MCTargetAsm
return (STI.getFeatureBits() & Mips::FeatureFP64Bit) != 0;
}
+ bool isN32() const { return STI.getFeatureBits() & Mips::FeatureN32; }
bool isN64() const { return STI.getFeatureBits() & Mips::FeatureN64; }
bool isMicroMips() const {
@@ -1035,21 +1036,23 @@ int MipsAsmParser::matchCPURegisterName(
.Case("t9", 25)
.Default(-1);
- // Although SGI documentation just cuts out t0-t3 for n32/n64,
- // GNU pushes the values of t0-t3 to override the o32/o64 values for t4-t7
- // We are supporting both cases, so for t0-t3 we'll just push them to t4-t7.
- if (isMips64() && 8 <= CC && CC <= 11)
- CC += 4;
-
- if (CC == -1 && isMips64())
- CC = StringSwitch<unsigned>(Name)
- .Case("a4", 8)
- .Case("a5", 9)
- .Case("a6", 10)
- .Case("a7", 11)
- .Case("kt0", 26)
- .Case("kt1", 27)
- .Default(-1);
+ if (isN32() || isN64()) {
+ // Although SGI documentation just cuts out t0-t3 for n32/n64,
+ // GNU pushes the values of t0-t3 to override the o32/o64 values for t4-t7
+ // We are supporting both cases, so for t0-t3 we'll just push them to t4-t7.
+ if (8 <= CC && CC <= 11)
+ CC += 4;
+
+ if (CC == -1)
+ CC = StringSwitch<unsigned>(Name)
+ .Case("a4", 8)
+ .Case("a5", 9)
+ .Case("a6", 10)
+ .Case("a7", 11)
+ .Case("kt0", 26)
+ .Case("kt1", 27)
+ .Default(-1);
+ }
warnIfAssemblerTemporary(CC);
Copied: llvm/trunk/test/MC/Mips/mips-register-names-o32.s (from r204793, llvm/trunk/test/MC/Mips/mips-register-names.s)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips-register-names-o32.s?p2=llvm/trunk/test/MC/Mips/mips-register-names-o32.s&p1=llvm/trunk/test/MC/Mips/mips-register-names.s&r1=204793&r2=204796&rev=204796&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/mips-register-names.s (original)
+++ llvm/trunk/test/MC/Mips/mips-register-names-o32.s Wed Mar 26 06:39:07 2014
@@ -4,6 +4,7 @@
# Second byte of addiu with $zero at rt contains the number of the source
# register.
+.set noat
addiu $zero, $zero, 0 # CHECK: encoding: [0x24,0x00,0x00,0x00]
addiu $at, $zero, 0 # CHECK: encoding: [0x24,0x01,0x00,0x00]
addiu $v0, $zero, 0 # CHECK: encoding: [0x24,0x02,0x00,0x00]
Removed: llvm/trunk/test/MC/Mips/mips-register-names.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips-register-names.s?rev=204795&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/mips-register-names.s (original)
+++ llvm/trunk/test/MC/Mips/mips-register-names.s (removed)
@@ -1,39 +0,0 @@
-# RUN: llvm-mc %s -triple=mips-unknown-freebsd -show-encoding | FileCheck %s
-
-# Check that the register names are mapped to their correct numbers for o32
-# Second byte of addiu with $zero at rt contains the number of the source
-# register.
-
-addiu $zero, $zero, 0 # CHECK: encoding: [0x24,0x00,0x00,0x00]
-addiu $at, $zero, 0 # CHECK: encoding: [0x24,0x01,0x00,0x00]
-addiu $v0, $zero, 0 # CHECK: encoding: [0x24,0x02,0x00,0x00]
-addiu $v1, $zero, 0 # CHECK: encoding: [0x24,0x03,0x00,0x00]
-addiu $a0, $zero, 0 # CHECK: encoding: [0x24,0x04,0x00,0x00]
-addiu $a1, $zero, 0 # CHECK: encoding: [0x24,0x05,0x00,0x00]
-addiu $a2, $zero, 0 # CHECK: encoding: [0x24,0x06,0x00,0x00]
-addiu $a3, $zero, 0 # CHECK: encoding: [0x24,0x07,0x00,0x00]
-addiu $t0, $zero, 0 # CHECK: encoding: [0x24,0x08,0x00,0x00]
-addiu $t1, $zero, 0 # CHECK: encoding: [0x24,0x09,0x00,0x00]
-addiu $t2, $zero, 0 # CHECK: encoding: [0x24,0x0a,0x00,0x00]
-addiu $t3, $zero, 0 # CHECK: encoding: [0x24,0x0b,0x00,0x00]
-addiu $t4, $zero, 0 # CHECK: encoding: [0x24,0x0c,0x00,0x00]
-addiu $t5, $zero, 0 # CHECK: encoding: [0x24,0x0d,0x00,0x00]
-addiu $t6, $zero, 0 # CHECK: encoding: [0x24,0x0e,0x00,0x00]
-addiu $t7, $zero, 0 # CHECK: encoding: [0x24,0x0f,0x00,0x00]
-addiu $s0, $zero, 0 # CHECK: encoding: [0x24,0x10,0x00,0x00]
-addiu $s1, $zero, 0 # CHECK: encoding: [0x24,0x11,0x00,0x00]
-addiu $s2, $zero, 0 # CHECK: encoding: [0x24,0x12,0x00,0x00]
-addiu $s3, $zero, 0 # CHECK: encoding: [0x24,0x13,0x00,0x00]
-addiu $s4, $zero, 0 # CHECK: encoding: [0x24,0x14,0x00,0x00]
-addiu $s5, $zero, 0 # CHECK: encoding: [0x24,0x15,0x00,0x00]
-addiu $s6, $zero, 0 # CHECK: encoding: [0x24,0x16,0x00,0x00]
-addiu $s7, $zero, 0 # CHECK: encoding: [0x24,0x17,0x00,0x00]
-addiu $t8, $zero, 0 # CHECK: encoding: [0x24,0x18,0x00,0x00]
-addiu $t9, $zero, 0 # CHECK: encoding: [0x24,0x19,0x00,0x00]
-addiu $k0, $zero, 0 # CHECK: encoding: [0x24,0x1a,0x00,0x00]
-addiu $k1, $zero, 0 # CHECK: encoding: [0x24,0x1b,0x00,0x00]
-addiu $gp, $zero, 0 # CHECK: encoding: [0x24,0x1c,0x00,0x00]
-addiu $sp, $zero, 0 # CHECK: encoding: [0x24,0x1d,0x00,0x00]
-addiu $fp, $zero, 0 # CHECK: encoding: [0x24,0x1e,0x00,0x00]
-addiu $s8, $zero, 0 # CHECK: encoding: [0x24,0x1e,0x00,0x00]
-addiu $ra, $zero, 0 # CHECK: encoding: [0x24,0x1f,0x00,0x00]
Copied: llvm/trunk/test/MC/Mips/mips64-register-names-n32-n64.s (from r204793, llvm/trunk/test/MC/Mips/mips64-register-names.s)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips64-register-names-n32-n64.s?p2=llvm/trunk/test/MC/Mips/mips64-register-names-n32-n64.s&p1=llvm/trunk/test/MC/Mips/mips64-register-names.s&r1=204793&r2=204796&rev=204796&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/mips64-register-names.s (original)
+++ llvm/trunk/test/MC/Mips/mips64-register-names-n32-n64.s Wed Mar 26 06:39:07 2014
@@ -1,9 +1,12 @@
# RUN: llvm-mc %s -triple=mips64-unknown-freebsd -show-encoding | FileCheck %s
+# RUN: llvm-mc %s -triple=mips64-unknown-freebsd -show-encoding \
+# RUN: -mattr=-n64,+n32 | FileCheck %s
-# Check that the register names are mapped to their correct numbers for n64
+# Check that the register names are mapped to their correct numbers for n32/n64
# Second byte of addiu with $zero at rt contains the number of the source
# register.
+.set noat
daddiu $zero, $zero, 0 # CHECK: encoding: [0x64,0x00,0x00,0x00]
daddiu $at, $zero, 0 # CHECK: encoding: [0x64,0x01,0x00,0x00]
daddiu $v0, $zero, 0 # CHECK: encoding: [0x64,0x02,0x00,0x00]
Added: llvm/trunk/test/MC/Mips/mips64-register-names-o32.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips64-register-names-o32.s?rev=204796&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/mips64-register-names-o32.s (added)
+++ llvm/trunk/test/MC/Mips/mips64-register-names-o32.s Wed Mar 26 06:39:07 2014
@@ -0,0 +1,41 @@
+# RUN: llvm-mc %s -triple=mips64-unknown-freebsd -show-encoding \
+# RUN: -mattr=-n64,+o32 | FileCheck %s
+
+# Check that the register names are mapped to their correct numbers for o32
+# Second byte of daddiu with $zero at rt contains the number of the source
+# register.
+
+.set noat
+daddiu $zero, $zero, 0 # CHECK: encoding: [0x64,0x00,0x00,0x00]
+daddiu $at, $zero, 0 # CHECK: encoding: [0x64,0x01,0x00,0x00]
+daddiu $v0, $zero, 0 # CHECK: encoding: [0x64,0x02,0x00,0x00]
+daddiu $v1, $zero, 0 # CHECK: encoding: [0x64,0x03,0x00,0x00]
+daddiu $a0, $zero, 0 # CHECK: encoding: [0x64,0x04,0x00,0x00]
+daddiu $a1, $zero, 0 # CHECK: encoding: [0x64,0x05,0x00,0x00]
+daddiu $a2, $zero, 0 # CHECK: encoding: [0x64,0x06,0x00,0x00]
+daddiu $a3, $zero, 0 # CHECK: encoding: [0x64,0x07,0x00,0x00]
+daddiu $t0, $zero, 0 # CHECK: encoding: [0x64,0x08,0x00,0x00]
+daddiu $t1, $zero, 0 # CHECK: encoding: [0x64,0x09,0x00,0x00]
+daddiu $t2, $zero, 0 # CHECK: encoding: [0x64,0x0a,0x00,0x00]
+daddiu $t3, $zero, 0 # CHECK: encoding: [0x64,0x0b,0x00,0x00]
+daddiu $t4, $zero, 0 # CHECK: encoding: [0x64,0x0c,0x00,0x00]
+daddiu $t5, $zero, 0 # CHECK: encoding: [0x64,0x0d,0x00,0x00]
+daddiu $t6, $zero, 0 # CHECK: encoding: [0x64,0x0e,0x00,0x00]
+daddiu $t7, $zero, 0 # CHECK: encoding: [0x64,0x0f,0x00,0x00]
+daddiu $s0, $zero, 0 # CHECK: encoding: [0x64,0x10,0x00,0x00]
+daddiu $s1, $zero, 0 # CHECK: encoding: [0x64,0x11,0x00,0x00]
+daddiu $s2, $zero, 0 # CHECK: encoding: [0x64,0x12,0x00,0x00]
+daddiu $s3, $zero, 0 # CHECK: encoding: [0x64,0x13,0x00,0x00]
+daddiu $s4, $zero, 0 # CHECK: encoding: [0x64,0x14,0x00,0x00]
+daddiu $s5, $zero, 0 # CHECK: encoding: [0x64,0x15,0x00,0x00]
+daddiu $s6, $zero, 0 # CHECK: encoding: [0x64,0x16,0x00,0x00]
+daddiu $s7, $zero, 0 # CHECK: encoding: [0x64,0x17,0x00,0x00]
+daddiu $t8, $zero, 0 # CHECK: encoding: [0x64,0x18,0x00,0x00]
+daddiu $t9, $zero, 0 # CHECK: encoding: [0x64,0x19,0x00,0x00]
+daddiu $k0, $zero, 0 # CHECK: encoding: [0x64,0x1a,0x00,0x00]
+daddiu $k1, $zero, 0 # CHECK: encoding: [0x64,0x1b,0x00,0x00]
+daddiu $gp, $zero, 0 # CHECK: encoding: [0x64,0x1c,0x00,0x00]
+daddiu $sp, $zero, 0 # CHECK: encoding: [0x64,0x1d,0x00,0x00]
+daddiu $fp, $zero, 0 # CHECK: encoding: [0x64,0x1e,0x00,0x00]
+daddiu $s8, $zero, 0 # CHECK: encoding: [0x64,0x1e,0x00,0x00]
+daddiu $ra, $zero, 0 # CHECK: encoding: [0x64,0x1f,0x00,0x00]
Removed: llvm/trunk/test/MC/Mips/mips64-register-names.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips64-register-names.s?rev=204795&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/mips64-register-names.s (original)
+++ llvm/trunk/test/MC/Mips/mips64-register-names.s (removed)
@@ -1,39 +0,0 @@
-# RUN: llvm-mc %s -triple=mips64-unknown-freebsd -show-encoding | FileCheck %s
-
-# Check that the register names are mapped to their correct numbers for n64
-# Second byte of addiu with $zero at rt contains the number of the source
-# register.
-
-daddiu $zero, $zero, 0 # CHECK: encoding: [0x64,0x00,0x00,0x00]
-daddiu $at, $zero, 0 # CHECK: encoding: [0x64,0x01,0x00,0x00]
-daddiu $v0, $zero, 0 # CHECK: encoding: [0x64,0x02,0x00,0x00]
-daddiu $v1, $zero, 0 # CHECK: encoding: [0x64,0x03,0x00,0x00]
-daddiu $a0, $zero, 0 # CHECK: encoding: [0x64,0x04,0x00,0x00]
-daddiu $a1, $zero, 0 # CHECK: encoding: [0x64,0x05,0x00,0x00]
-daddiu $a2, $zero, 0 # CHECK: encoding: [0x64,0x06,0x00,0x00]
-daddiu $a3, $zero, 0 # CHECK: encoding: [0x64,0x07,0x00,0x00]
-daddiu $a4, $zero, 0 # CHECK: encoding: [0x64,0x08,0x00,0x00]
-daddiu $a5, $zero, 0 # CHECK: encoding: [0x64,0x09,0x00,0x00]
-daddiu $a6, $zero, 0 # CHECK: encoding: [0x64,0x0a,0x00,0x00]
-daddiu $a7, $zero, 0 # CHECK: encoding: [0x64,0x0b,0x00,0x00]
-daddiu $t4, $zero, 0 # CHECK: encoding: [0x64,0x0c,0x00,0x00]
-daddiu $t5, $zero, 0 # CHECK: encoding: [0x64,0x0d,0x00,0x00]
-daddiu $t6, $zero, 0 # CHECK: encoding: [0x64,0x0e,0x00,0x00]
-daddiu $t7, $zero, 0 # CHECK: encoding: [0x64,0x0f,0x00,0x00]
-daddiu $s0, $zero, 0 # CHECK: encoding: [0x64,0x10,0x00,0x00]
-daddiu $s1, $zero, 0 # CHECK: encoding: [0x64,0x11,0x00,0x00]
-daddiu $s2, $zero, 0 # CHECK: encoding: [0x64,0x12,0x00,0x00]
-daddiu $s3, $zero, 0 # CHECK: encoding: [0x64,0x13,0x00,0x00]
-daddiu $s4, $zero, 0 # CHECK: encoding: [0x64,0x14,0x00,0x00]
-daddiu $s5, $zero, 0 # CHECK: encoding: [0x64,0x15,0x00,0x00]
-daddiu $s6, $zero, 0 # CHECK: encoding: [0x64,0x16,0x00,0x00]
-daddiu $s7, $zero, 0 # CHECK: encoding: [0x64,0x17,0x00,0x00]
-daddiu $t8, $zero, 0 # CHECK: encoding: [0x64,0x18,0x00,0x00]
-daddiu $t9, $zero, 0 # CHECK: encoding: [0x64,0x19,0x00,0x00]
-daddiu $kt0, $zero, 0 # CHECK: encoding: [0x64,0x1a,0x00,0x00]
-daddiu $kt1, $zero, 0 # CHECK: encoding: [0x64,0x1b,0x00,0x00]
-daddiu $gp, $zero, 0 # CHECK: encoding: [0x64,0x1c,0x00,0x00]
-daddiu $sp, $zero, 0 # CHECK: encoding: [0x64,0x1d,0x00,0x00]
-daddiu $s8, $zero, 0 # CHECK: encoding: [0x64,0x1e,0x00,0x00]
-daddiu $fp, $zero, 0 # CHECK: encoding: [0x64,0x1e,0x00,0x00]
-daddiu $ra, $zero, 0 # CHECK: encoding: [0x64,0x1f,0x00,0x00]
More information about the llvm-commits
mailing list