llvm.org GIT mirror llvm / 968ea7b
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204796 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Sanders 6 years ago
6 changed file(s) with 141 addition(s) and 93 deletion(s). Raw diff Collapse all Expand all
221221 return (STI.getFeatureBits() & Mips::FeatureFP64Bit) != 0;
222222 }
223223
224 bool isN32() const { return STI.getFeatureBits() & Mips::FeatureN32; }
224225 bool isN64() const { return STI.getFeatureBits() & Mips::FeatureN64; }
225226
226227 bool isMicroMips() const {
10341035 .Case("t9", 25)
10351036 .Default(-1);
10361037
1037 // Although SGI documentation just cuts out t0-t3 for n32/n64,
1038 // GNU pushes the values of t0-t3 to override the o32/o64 values for t4-t7
1039 // We are supporting both cases, so for t0-t3 we'll just push them to t4-t7.
1040 if (isMips64() && 8 <= CC && CC <= 11)
1041 CC += 4;
1042
1043 if (CC == -1 && isMips64())
1044 CC = StringSwitch(Name)
1045 .Case("a4", 8)
1046 .Case("a5", 9)
1047 .Case("a6", 10)
1048 .Case("a7", 11)
1049 .Case("kt0", 26)
1050 .Case("kt1", 27)
1051 .Default(-1);
1038 if (isN32() || isN64()) {
1039 // Although SGI documentation just cuts out t0-t3 for n32/n64,
1040 // GNU pushes the values of t0-t3 to override the o32/o64 values for t4-t7
1041 // We are supporting both cases, so for t0-t3 we'll just push them to t4-t7.
1042 if (8 <= CC && CC <= 11)
1043 CC += 4;
1044
1045 if (CC == -1)
1046 CC = StringSwitch(Name)
1047 .Case("a4", 8)
1048 .Case("a5", 9)
1049 .Case("a6", 10)
1050 .Case("a7", 11)
1051 .Case("kt0", 26)
1052 .Case("kt1", 27)
1053 .Default(-1);
1054 }
10521055
10531056 warnIfAssemblerTemporary(CC);
10541057
0 # RUN: llvm-mc %s -triple=mips-unknown-freebsd -show-encoding | FileCheck %s
1
2 # Check that the register names are mapped to their correct numbers for o32
3 # Second byte of addiu with $zero at rt contains the number of the source
4 # register.
5
6 .set noat
7 addiu $zero, $zero, 0 # CHECK: encoding: [0x24,0x00,0x00,0x00]
8 addiu $at, $zero, 0 # CHECK: encoding: [0x24,0x01,0x00,0x00]
9 addiu $v0, $zero, 0 # CHECK: encoding: [0x24,0x02,0x00,0x00]
10 addiu $v1, $zero, 0 # CHECK: encoding: [0x24,0x03,0x00,0x00]
11 addiu $a0, $zero, 0 # CHECK: encoding: [0x24,0x04,0x00,0x00]
12 addiu $a1, $zero, 0 # CHECK: encoding: [0x24,0x05,0x00,0x00]
13 addiu $a2, $zero, 0 # CHECK: encoding: [0x24,0x06,0x00,0x00]
14 addiu $a3, $zero, 0 # CHECK: encoding: [0x24,0x07,0x00,0x00]
15 addiu $t0, $zero, 0 # CHECK: encoding: [0x24,0x08,0x00,0x00]
16 addiu $t1, $zero, 0 # CHECK: encoding: [0x24,0x09,0x00,0x00]
17 addiu $t2, $zero, 0 # CHECK: encoding: [0x24,0x0a,0x00,0x00]
18 addiu $t3, $zero, 0 # CHECK: encoding: [0x24,0x0b,0x00,0x00]
19 addiu $t4, $zero, 0 # CHECK: encoding: [0x24,0x0c,0x00,0x00]
20 addiu $t5, $zero, 0 # CHECK: encoding: [0x24,0x0d,0x00,0x00]
21 addiu $t6, $zero, 0 # CHECK: encoding: [0x24,0x0e,0x00,0x00]
22 addiu $t7, $zero, 0 # CHECK: encoding: [0x24,0x0f,0x00,0x00]
23 addiu $s0, $zero, 0 # CHECK: encoding: [0x24,0x10,0x00,0x00]
24 addiu $s1, $zero, 0 # CHECK: encoding: [0x24,0x11,0x00,0x00]
25 addiu $s2, $zero, 0 # CHECK: encoding: [0x24,0x12,0x00,0x00]
26 addiu $s3, $zero, 0 # CHECK: encoding: [0x24,0x13,0x00,0x00]
27 addiu $s4, $zero, 0 # CHECK: encoding: [0x24,0x14,0x00,0x00]
28 addiu $s5, $zero, 0 # CHECK: encoding: [0x24,0x15,0x00,0x00]
29 addiu $s6, $zero, 0 # CHECK: encoding: [0x24,0x16,0x00,0x00]
30 addiu $s7, $zero, 0 # CHECK: encoding: [0x24,0x17,0x00,0x00]
31 addiu $t8, $zero, 0 # CHECK: encoding: [0x24,0x18,0x00,0x00]
32 addiu $t9, $zero, 0 # CHECK: encoding: [0x24,0x19,0x00,0x00]
33 addiu $k0, $zero, 0 # CHECK: encoding: [0x24,0x1a,0x00,0x00]
34 addiu $k1, $zero, 0 # CHECK: encoding: [0x24,0x1b,0x00,0x00]
35 addiu $gp, $zero, 0 # CHECK: encoding: [0x24,0x1c,0x00,0x00]
36 addiu $sp, $zero, 0 # CHECK: encoding: [0x24,0x1d,0x00,0x00]
37 addiu $fp, $zero, 0 # CHECK: encoding: [0x24,0x1e,0x00,0x00]
38 addiu $s8, $zero, 0 # CHECK: encoding: [0x24,0x1e,0x00,0x00]
39 addiu $ra, $zero, 0 # CHECK: encoding: [0x24,0x1f,0x00,0x00]
+0
-39
test/MC/Mips/mips-register-names.s less more
None # RUN: llvm-mc %s -triple=mips-unknown-freebsd -show-encoding | FileCheck %s
1
2 # Check that the register names are mapped to their correct numbers for o32
3 # Second byte of addiu with $zero at rt contains the number of the source
4 # register.
5
6 addiu $zero, $zero, 0 # CHECK: encoding: [0x24,0x00,0x00,0x00]
7 addiu $at, $zero, 0 # CHECK: encoding: [0x24,0x01,0x00,0x00]
8 addiu $v0, $zero, 0 # CHECK: encoding: [0x24,0x02,0x00,0x00]
9 addiu $v1, $zero, 0 # CHECK: encoding: [0x24,0x03,0x00,0x00]
10 addiu $a0, $zero, 0 # CHECK: encoding: [0x24,0x04,0x00,0x00]
11 addiu $a1, $zero, 0 # CHECK: encoding: [0x24,0x05,0x00,0x00]
12 addiu $a2, $zero, 0 # CHECK: encoding: [0x24,0x06,0x00,0x00]
13 addiu $a3, $zero, 0 # CHECK: encoding: [0x24,0x07,0x00,0x00]
14 addiu $t0, $zero, 0 # CHECK: encoding: [0x24,0x08,0x00,0x00]
15 addiu $t1, $zero, 0 # CHECK: encoding: [0x24,0x09,0x00,0x00]
16 addiu $t2, $zero, 0 # CHECK: encoding: [0x24,0x0a,0x00,0x00]
17 addiu $t3, $zero, 0 # CHECK: encoding: [0x24,0x0b,0x00,0x00]
18 addiu $t4, $zero, 0 # CHECK: encoding: [0x24,0x0c,0x00,0x00]
19 addiu $t5, $zero, 0 # CHECK: encoding: [0x24,0x0d,0x00,0x00]
20 addiu $t6, $zero, 0 # CHECK: encoding: [0x24,0x0e,0x00,0x00]
21 addiu $t7, $zero, 0 # CHECK: encoding: [0x24,0x0f,0x00,0x00]
22 addiu $s0, $zero, 0 # CHECK: encoding: [0x24,0x10,0x00,0x00]
23 addiu $s1, $zero, 0 # CHECK: encoding: [0x24,0x11,0x00,0x00]
24 addiu $s2, $zero, 0 # CHECK: encoding: [0x24,0x12,0x00,0x00]
25 addiu $s3, $zero, 0 # CHECK: encoding: [0x24,0x13,0x00,0x00]
26 addiu $s4, $zero, 0 # CHECK: encoding: [0x24,0x14,0x00,0x00]
27 addiu $s5, $zero, 0 # CHECK: encoding: [0x24,0x15,0x00,0x00]
28 addiu $s6, $zero, 0 # CHECK: encoding: [0x24,0x16,0x00,0x00]
29 addiu $s7, $zero, 0 # CHECK: encoding: [0x24,0x17,0x00,0x00]
30 addiu $t8, $zero, 0 # CHECK: encoding: [0x24,0x18,0x00,0x00]
31 addiu $t9, $zero, 0 # CHECK: encoding: [0x24,0x19,0x00,0x00]
32 addiu $k0, $zero, 0 # CHECK: encoding: [0x24,0x1a,0x00,0x00]
33 addiu $k1, $zero, 0 # CHECK: encoding: [0x24,0x1b,0x00,0x00]
34 addiu $gp, $zero, 0 # CHECK: encoding: [0x24,0x1c,0x00,0x00]
35 addiu $sp, $zero, 0 # CHECK: encoding: [0x24,0x1d,0x00,0x00]
36 addiu $fp, $zero, 0 # CHECK: encoding: [0x24,0x1e,0x00,0x00]
37 addiu $s8, $zero, 0 # CHECK: encoding: [0x24,0x1e,0x00,0x00]
38 addiu $ra, $zero, 0 # CHECK: encoding: [0x24,0x1f,0x00,0x00]
0 # RUN: llvm-mc %s -triple=mips64-unknown-freebsd -show-encoding | FileCheck %s
1 # RUN: llvm-mc %s -triple=mips64-unknown-freebsd -show-encoding \
2 # RUN: -mattr=-n64,+n32 | FileCheck %s
3
4 # Check that the register names are mapped to their correct numbers for n32/n64
5 # Second byte of addiu with $zero at rt contains the number of the source
6 # register.
7
8 .set noat
9 daddiu $zero, $zero, 0 # CHECK: encoding: [0x64,0x00,0x00,0x00]
10 daddiu $at, $zero, 0 # CHECK: encoding: [0x64,0x01,0x00,0x00]
11 daddiu $v0, $zero, 0 # CHECK: encoding: [0x64,0x02,0x00,0x00]
12 daddiu $v1, $zero, 0 # CHECK: encoding: [0x64,0x03,0x00,0x00]
13 daddiu $a0, $zero, 0 # CHECK: encoding: [0x64,0x04,0x00,0x00]
14 daddiu $a1, $zero, 0 # CHECK: encoding: [0x64,0x05,0x00,0x00]
15 daddiu $a2, $zero, 0 # CHECK: encoding: [0x64,0x06,0x00,0x00]
16 daddiu $a3, $zero, 0 # CHECK: encoding: [0x64,0x07,0x00,0x00]
17 daddiu $a4, $zero, 0 # CHECK: encoding: [0x64,0x08,0x00,0x00]
18 daddiu $a5, $zero, 0 # CHECK: encoding: [0x64,0x09,0x00,0x00]
19 daddiu $a6, $zero, 0 # CHECK: encoding: [0x64,0x0a,0x00,0x00]
20 daddiu $a7, $zero, 0 # CHECK: encoding: [0x64,0x0b,0x00,0x00]
21 daddiu $t4, $zero, 0 # CHECK: encoding: [0x64,0x0c,0x00,0x00]
22 daddiu $t5, $zero, 0 # CHECK: encoding: [0x64,0x0d,0x00,0x00]
23 daddiu $t6, $zero, 0 # CHECK: encoding: [0x64,0x0e,0x00,0x00]
24 daddiu $t7, $zero, 0 # CHECK: encoding: [0x64,0x0f,0x00,0x00]
25 daddiu $s0, $zero, 0 # CHECK: encoding: [0x64,0x10,0x00,0x00]
26 daddiu $s1, $zero, 0 # CHECK: encoding: [0x64,0x11,0x00,0x00]
27 daddiu $s2, $zero, 0 # CHECK: encoding: [0x64,0x12,0x00,0x00]
28 daddiu $s3, $zero, 0 # CHECK: encoding: [0x64,0x13,0x00,0x00]
29 daddiu $s4, $zero, 0 # CHECK: encoding: [0x64,0x14,0x00,0x00]
30 daddiu $s5, $zero, 0 # CHECK: encoding: [0x64,0x15,0x00,0x00]
31 daddiu $s6, $zero, 0 # CHECK: encoding: [0x64,0x16,0x00,0x00]
32 daddiu $s7, $zero, 0 # CHECK: encoding: [0x64,0x17,0x00,0x00]
33 daddiu $t8, $zero, 0 # CHECK: encoding: [0x64,0x18,0x00,0x00]
34 daddiu $t9, $zero, 0 # CHECK: encoding: [0x64,0x19,0x00,0x00]
35 daddiu $kt0, $zero, 0 # CHECK: encoding: [0x64,0x1a,0x00,0x00]
36 daddiu $kt1, $zero, 0 # CHECK: encoding: [0x64,0x1b,0x00,0x00]
37 daddiu $gp, $zero, 0 # CHECK: encoding: [0x64,0x1c,0x00,0x00]
38 daddiu $sp, $zero, 0 # CHECK: encoding: [0x64,0x1d,0x00,0x00]
39 daddiu $s8, $zero, 0 # CHECK: encoding: [0x64,0x1e,0x00,0x00]
40 daddiu $fp, $zero, 0 # CHECK: encoding: [0x64,0x1e,0x00,0x00]
41 daddiu $ra, $zero, 0 # CHECK: encoding: [0x64,0x1f,0x00,0x00]
0 # RUN: llvm-mc %s -triple=mips64-unknown-freebsd -show-encoding \
1 # RUN: -mattr=-n64,+o32 | FileCheck %s
2
3 # Check that the register names are mapped to their correct numbers for o32
4 # Second byte of daddiu with $zero at rt contains the number of the source
5 # register.
6
7 .set noat
8 daddiu $zero, $zero, 0 # CHECK: encoding: [0x64,0x00,0x00,0x00]
9 daddiu $at, $zero, 0 # CHECK: encoding: [0x64,0x01,0x00,0x00]
10 daddiu $v0, $zero, 0 # CHECK: encoding: [0x64,0x02,0x00,0x00]
11 daddiu $v1, $zero, 0 # CHECK: encoding: [0x64,0x03,0x00,0x00]
12 daddiu $a0, $zero, 0 # CHECK: encoding: [0x64,0x04,0x00,0x00]
13 daddiu $a1, $zero, 0 # CHECK: encoding: [0x64,0x05,0x00,0x00]
14 daddiu $a2, $zero, 0 # CHECK: encoding: [0x64,0x06,0x00,0x00]
15 daddiu $a3, $zero, 0 # CHECK: encoding: [0x64,0x07,0x00,0x00]
16 daddiu $t0, $zero, 0 # CHECK: encoding: [0x64,0x08,0x00,0x00]
17 daddiu $t1, $zero, 0 # CHECK: encoding: [0x64,0x09,0x00,0x00]
18 daddiu $t2, $zero, 0 # CHECK: encoding: [0x64,0x0a,0x00,0x00]
19 daddiu $t3, $zero, 0 # CHECK: encoding: [0x64,0x0b,0x00,0x00]
20 daddiu $t4, $zero, 0 # CHECK: encoding: [0x64,0x0c,0x00,0x00]
21 daddiu $t5, $zero, 0 # CHECK: encoding: [0x64,0x0d,0x00,0x00]
22 daddiu $t6, $zero, 0 # CHECK: encoding: [0x64,0x0e,0x00,0x00]
23 daddiu $t7, $zero, 0 # CHECK: encoding: [0x64,0x0f,0x00,0x00]
24 daddiu $s0, $zero, 0 # CHECK: encoding: [0x64,0x10,0x00,0x00]
25 daddiu $s1, $zero, 0 # CHECK: encoding: [0x64,0x11,0x00,0x00]
26 daddiu $s2, $zero, 0 # CHECK: encoding: [0x64,0x12,0x00,0x00]
27 daddiu $s3, $zero, 0 # CHECK: encoding: [0x64,0x13,0x00,0x00]
28 daddiu $s4, $zero, 0 # CHECK: encoding: [0x64,0x14,0x00,0x00]
29 daddiu $s5, $zero, 0 # CHECK: encoding: [0x64,0x15,0x00,0x00]
30 daddiu $s6, $zero, 0 # CHECK: encoding: [0x64,0x16,0x00,0x00]
31 daddiu $s7, $zero, 0 # CHECK: encoding: [0x64,0x17,0x00,0x00]
32 daddiu $t8, $zero, 0 # CHECK: encoding: [0x64,0x18,0x00,0x00]
33 daddiu $t9, $zero, 0 # CHECK: encoding: [0x64,0x19,0x00,0x00]
34 daddiu $k0, $zero, 0 # CHECK: encoding: [0x64,0x1a,0x00,0x00]
35 daddiu $k1, $zero, 0 # CHECK: encoding: [0x64,0x1b,0x00,0x00]
36 daddiu $gp, $zero, 0 # CHECK: encoding: [0x64,0x1c,0x00,0x00]
37 daddiu $sp, $zero, 0 # CHECK: encoding: [0x64,0x1d,0x00,0x00]
38 daddiu $fp, $zero, 0 # CHECK: encoding: [0x64,0x1e,0x00,0x00]
39 daddiu $s8, $zero, 0 # CHECK: encoding: [0x64,0x1e,0x00,0x00]
40 daddiu $ra, $zero, 0 # CHECK: encoding: [0x64,0x1f,0x00,0x00]
+0
-39
test/MC/Mips/mips64-register-names.s less more
None # RUN: llvm-mc %s -triple=mips64-unknown-freebsd -show-encoding | FileCheck %s
1
2 # Check that the register names are mapped to their correct numbers for n64
3 # Second byte of addiu with $zero at rt contains the number of the source
4 # register.
5
6 daddiu $zero, $zero, 0 # CHECK: encoding: [0x64,0x00,0x00,0x00]
7 daddiu $at, $zero, 0 # CHECK: encoding: [0x64,0x01,0x00,0x00]
8 daddiu $v0, $zero, 0 # CHECK: encoding: [0x64,0x02,0x00,0x00]
9 daddiu $v1, $zero, 0 # CHECK: encoding: [0x64,0x03,0x00,0x00]
10 daddiu $a0, $zero, 0 # CHECK: encoding: [0x64,0x04,0x00,0x00]
11 daddiu $a1, $zero, 0 # CHECK: encoding: [0x64,0x05,0x00,0x00]
12 daddiu $a2, $zero, 0 # CHECK: encoding: [0x64,0x06,0x00,0x00]
13 daddiu $a3, $zero, 0 # CHECK: encoding: [0x64,0x07,0x00,0x00]
14 daddiu $a4, $zero, 0 # CHECK: encoding: [0x64,0x08,0x00,0x00]
15 daddiu $a5, $zero, 0 # CHECK: encoding: [0x64,0x09,0x00,0x00]
16 daddiu $a6, $zero, 0 # CHECK: encoding: [0x64,0x0a,0x00,0x00]
17 daddiu $a7, $zero, 0 # CHECK: encoding: [0x64,0x0b,0x00,0x00]
18 daddiu $t4, $zero, 0 # CHECK: encoding: [0x64,0x0c,0x00,0x00]
19 daddiu $t5, $zero, 0 # CHECK: encoding: [0x64,0x0d,0x00,0x00]
20 daddiu $t6, $zero, 0 # CHECK: encoding: [0x64,0x0e,0x00,0x00]
21 daddiu $t7, $zero, 0 # CHECK: encoding: [0x64,0x0f,0x00,0x00]
22 daddiu $s0, $zero, 0 # CHECK: encoding: [0x64,0x10,0x00,0x00]
23 daddiu $s1, $zero, 0 # CHECK: encoding: [0x64,0x11,0x00,0x00]
24 daddiu $s2, $zero, 0 # CHECK: encoding: [0x64,0x12,0x00,0x00]
25 daddiu $s3, $zero, 0 # CHECK: encoding: [0x64,0x13,0x00,0x00]
26 daddiu $s4, $zero, 0 # CHECK: encoding: [0x64,0x14,0x00,0x00]
27 daddiu $s5, $zero, 0 # CHECK: encoding: [0x64,0x15,0x00,0x00]
28 daddiu $s6, $zero, 0 # CHECK: encoding: [0x64,0x16,0x00,0x00]
29 daddiu $s7, $zero, 0 # CHECK: encoding: [0x64,0x17,0x00,0x00]
30 daddiu $t8, $zero, 0 # CHECK: encoding: [0x64,0x18,0x00,0x00]
31 daddiu $t9, $zero, 0 # CHECK: encoding: [0x64,0x19,0x00,0x00]
32 daddiu $kt0, $zero, 0 # CHECK: encoding: [0x64,0x1a,0x00,0x00]
33 daddiu $kt1, $zero, 0 # CHECK: encoding: [0x64,0x1b,0x00,0x00]
34 daddiu $gp, $zero, 0 # CHECK: encoding: [0x64,0x1c,0x00,0x00]
35 daddiu $sp, $zero, 0 # CHECK: encoding: [0x64,0x1d,0x00,0x00]
36 daddiu $s8, $zero, 0 # CHECK: encoding: [0x64,0x1e,0x00,0x00]
37 daddiu $fp, $zero, 0 # CHECK: encoding: [0x64,0x1e,0x00,0x00]
38 daddiu $ra, $zero, 0 # CHECK: encoding: [0x64,0x1f,0x00,0x00]