diff options
| author | Toma Tabacu <toma.tabacu@imgtec.com> | 2015-05-15 09:42:11 +0000 |
|---|---|---|
| committer | Toma Tabacu <toma.tabacu@imgtec.com> | 2015-05-15 09:42:11 +0000 |
| commit | a3d056fd4cb8d587db98c158e78554620e68df0a (patch) | |
| tree | e94f00cbbeb1342f49403935d082eb1f0ac7b60a /llvm/test | |
| parent | 731dde91db80686eec141cc3ee0ef9594e1a85c6 (diff) | |
| download | bcm5719-llvm-a3d056fd4cb8d587db98c158e78554620e68df0a.tar.gz bcm5719-llvm-a3d056fd4cb8d587db98c158e78554620e68df0a.zip | |
[mips] [IAS] Fix expansion of negative 32-bit immediates for LI/DLI.
Summary:
To maintain compatibility with GAS, we need to stop treating negative 32-bit immediates as 64-bit values when expanding LI/DLI.
This currently happens because of sign extension.
To do this we need to choose the 32-bit value expansion for values which use their upper 33 bits only for sign extension (i.e. no 0's, only 1's).
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D8662
llvm-svn: 237428
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/MC/Mips/mips-expansions.s | 3 | ||||
| -rw-r--r-- | llvm/test/MC/Mips/mips64-expansions.s | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/MC/Mips/mips-expansions.s b/llvm/test/MC/Mips/mips-expansions.s index 5340448df1c..4ac707db429 100644 --- a/llvm/test/MC/Mips/mips-expansions.s +++ b/llvm/test/MC/Mips/mips-expansions.s @@ -11,6 +11,8 @@ # CHECK: addiu $8, $zero, -8 # encoding: [0xf8,0xff,0x08,0x24] # CHECK: lui $9, 1 # encoding: [0x01,0x00,0x09,0x3c] # CHECK-NOT: ori $9, $9, 0 # encoding: [0x00,0x00,0x29,0x35] +# CHECK: lui $10, 65519 # encoding: [0xef,0xff,0x0a,0x3c] +# CHECK: ori $10, $10, 61423 # encoding: [0xef,0xef,0x4a,0x35] # CHECK: ori $4, $zero, 20 # encoding: [0x14,0x00,0x04,0x34] # CHECK: lui $7, 1 # encoding: [0x01,0x00,0x07,0x3c] @@ -61,6 +63,7 @@ li $7,65538 li $8, ~7 li $9, 0x10000 + li $10, ~(0x101010) la $a0, 20 la $7,65538 diff --git a/llvm/test/MC/Mips/mips64-expansions.s b/llvm/test/MC/Mips/mips64-expansions.s index a4330ff32f7..62a95200f24 100644 --- a/llvm/test/MC/Mips/mips64-expansions.s +++ b/llvm/test/MC/Mips/mips64-expansions.s @@ -178,3 +178,18 @@ # CHECK: ori $8, $8, 65534 # encoding: [0xfe,0xff,0x08,0x35] # CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00] # CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35] + +# Check that signed negative 32-bit immediates are loaded correctly: + li $10, ~(0x101010) +# CHECK: lui $10, 65519 # encoding: [0xef,0xff,0x0a,0x3c] +# CHECK: ori $10, $10, 61423 # encoding: [0xef,0xef,0x4a,0x35] +# CHECK-NOT: dsll + + dli $10, ~(0x202020) +# CHECK: lui $10, 65503 # encoding: [0xdf,0xff,0x0a,0x3c] +# CHECK: ori $10, $10, 57311 # encoding: [0xdf,0xdf,0x4a,0x35] +# CHECK-NOT: dsll + + dli $9, 0x80000000 +# CHECK: ori $9, $zero, 32768 # encoding: [0x00,0x80,0x09,0x34] +# CHECK: dsll $9, $9, 16 # encoding: [0x38,0x4c,0x09,0x00] |

