2015-02-19 00:24:50 +08:00
|
|
|
# Instructions that are valid for the current ISA but should be rejected by the assembler (e.g.
|
|
|
|
# invalid set of operands or operand's restrictions not met).
|
|
|
|
|
|
|
|
# RUN: not llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32r5 2>%t1
|
2015-11-27 00:35:41 +08:00
|
|
|
# RUN: FileCheck %s < %t1
|
2015-02-19 00:24:50 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.set noreorder
|
2015-11-27 00:35:41 +08:00
|
|
|
cache -1, 255($7) # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
|
|
|
|
cache 32, 255($7) # CHECK: :[[@LINE]]:15: error: expected 5-bit unsigned immediate
|
|
|
|
jalr.hb $31 # CHECK: :[[@LINE]]:9: error: source and destination must be different
|
|
|
|
jalr.hb $31, $31 # CHECK: :[[@LINE]]:9: error: source and destination must be different
|
2016-05-12 20:46:06 +08:00
|
|
|
pref -1, 255($7) # CHECK: :[[@LINE]]:14: error: expected 5-bit unsigned immediate
|
|
|
|
pref 32, 255($7) # CHECK: :[[@LINE]]:14: error: expected 5-bit unsigned immediate
|
2016-03-11 16:00:11 +08:00
|
|
|
mtc0 $4, $3, -1 # CHECK: :[[@LINE]]:23: error: expected 3-bit unsigned immediate
|
|
|
|
mtc0 $4, $3, 8 # CHECK: :[[@LINE]]:23: error: expected 3-bit unsigned immediate
|
|
|
|
mtc2 $4, $3, -1 # CHECK: :[[@LINE]]:23: error: expected 3-bit unsigned immediate
|
|
|
|
mtc2 $4, $3, 8 # CHECK: :[[@LINE]]:23: error: expected 3-bit unsigned immediate
|
|
|
|
mfc0 $4, $3, -1 # CHECK: :[[@LINE]]:23: error: expected 3-bit unsigned immediate
|
|
|
|
mfc0 $4, $3, 8 # CHECK: :[[@LINE]]:23: error: expected 3-bit unsigned immediate
|
|
|
|
mfc2 $4, $3, -1 # CHECK: :[[@LINE]]:23: error: expected 3-bit unsigned immediate
|
|
|
|
mfc2 $4, $3, 8 # CHECK: :[[@LINE]]:23: error: expected 3-bit unsigned immediate
|
2018-04-25 00:14:00 +08:00
|
|
|
lb $32, 8($5) # CHECK: :[[@LINE]]:12: error: invalid register number
|
[mips] Accept 32-bit offsets for lb and lbu commands
`lb` and `lbu` commands accepts 16-bit signed offsets. But GAS accepts
larger offsets for these commands. If an offset does not fit in 16-bit
range, `lb` command is translated into lui/lb or lui/addu/lb series.
It's interesting that initially LLVM assembler supported this feature,
but later it was broken.
This patch restores support for 32-bit offsets. It replaces `mem_simm16`
operand for `LB` and `LBu` definitions by the new `mem_simmptr` operand.
This operand is intended to check that offset fits to the same size as
using for pointers. Later we will be able to extend this rule and
accepts 64-bit offsets when it is possible.
Some issues remain:
- The regression also affects LD, SD, LH, LHU commands. I'm going
to fix them by a separate patch.
- GAS accepts any 32-bit values as an offset. Now LLVM accepts signed
16-bit values and this patch extends the range to signed 32-bit offsets.
In other words, the following code accepted by GAS and still triggers
an error by LLVM:
```
lb $4, 0x80000004
# gas
lui a0, 0x8000
lb a0, 4(a0)
```
- In case of 64-bit pointers GAS accepts a 64-bit offset and translates
it to the li/dsll/lb series of commands. LLVM still rejects it.
Probably this feature has never been implemented in LLVM. This issue
is for a separate patch.
```
lb $4, 0x800000001
# gas
li a0, 0x8000
dsll a0, a0, 0x14
lb a0, 4(a0)
```
Differential Revision: https://reviews.llvm.org/D45020
llvm-svn: 330983
2018-04-27 03:55:28 +08:00
|
|
|
lb $4, -2147483649($5) # CHECK: :[[@LINE]]:16: error: expected memory with 32-bit signed offset
|
|
|
|
lb $4, 2147483648($5) # CHECK: :[[@LINE]]:16: error: expected memory with 32-bit signed offset
|
2018-04-25 00:14:00 +08:00
|
|
|
lb $4, 8($32) # CHECK: :[[@LINE]]:18: error: invalid register number
|
|
|
|
lbu $32, 8($5) # CHECK: :[[@LINE]]:13: error: invalid register number
|
[mips] Accept 32-bit offsets for lb and lbu commands
`lb` and `lbu` commands accepts 16-bit signed offsets. But GAS accepts
larger offsets for these commands. If an offset does not fit in 16-bit
range, `lb` command is translated into lui/lb or lui/addu/lb series.
It's interesting that initially LLVM assembler supported this feature,
but later it was broken.
This patch restores support for 32-bit offsets. It replaces `mem_simm16`
operand for `LB` and `LBu` definitions by the new `mem_simmptr` operand.
This operand is intended to check that offset fits to the same size as
using for pointers. Later we will be able to extend this rule and
accepts 64-bit offsets when it is possible.
Some issues remain:
- The regression also affects LD, SD, LH, LHU commands. I'm going
to fix them by a separate patch.
- GAS accepts any 32-bit values as an offset. Now LLVM accepts signed
16-bit values and this patch extends the range to signed 32-bit offsets.
In other words, the following code accepted by GAS and still triggers
an error by LLVM:
```
lb $4, 0x80000004
# gas
lui a0, 0x8000
lb a0, 4(a0)
```
- In case of 64-bit pointers GAS accepts a 64-bit offset and translates
it to the li/dsll/lb series of commands. LLVM still rejects it.
Probably this feature has never been implemented in LLVM. This issue
is for a separate patch.
```
lb $4, 0x800000001
# gas
li a0, 0x8000
dsll a0, a0, 0x14
lb a0, 4(a0)
```
Differential Revision: https://reviews.llvm.org/D45020
llvm-svn: 330983
2018-04-27 03:55:28 +08:00
|
|
|
lbu $4, -2147483649($5) # CHECK: :[[@LINE]]:17: error: expected memory with 32-bit signed offset
|
|
|
|
lbu $4, 2147483648($5) # CHECK: :[[@LINE]]:17: error: expected memory with 32-bit signed offset
|
2018-04-25 00:14:00 +08:00
|
|
|
lbu $4, 8($32) # CHECK: :[[@LINE]]:19: error: invalid register number
|
2016-07-11 15:41:56 +08:00
|
|
|
ldc1 $f32, 300($10) # CHECK: :[[@LINE]]:14: error: invalid operand for instruction
|
|
|
|
ldc1 $f7, -32769($10) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
|
|
|
ldc1 $f7, 32768($10) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
2018-04-25 00:14:00 +08:00
|
|
|
ldc1 $f7, 300($32) # CHECK: :[[@LINE]]:23: error: invalid register number
|
2016-07-11 15:41:56 +08:00
|
|
|
sdc1 $f32, 64($10) # CHECK: :[[@LINE]]:14: error: invalid operand for instruction
|
|
|
|
sdc1 $f7, -32769($10) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
|
|
|
sdc1 $f7, 32768($10) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
2018-04-25 00:14:00 +08:00
|
|
|
sdc1 $f7, 64($32) # CHECK: :[[@LINE]]:22: error: invalid register number
|
2016-07-11 15:41:56 +08:00
|
|
|
lwc1 $f32, 32($5) # CHECK: :[[@LINE]]:14: error: invalid operand for instruction
|
|
|
|
lwc1 $f2, -32769($5) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
|
|
|
lwc1 $f2, 32768($5) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
2018-04-25 00:14:00 +08:00
|
|
|
lwc1 $f2, 32($32) # CHECK: :[[@LINE]]:22: error: invalid register number
|
2016-07-11 15:41:56 +08:00
|
|
|
swc1 $f32, 369($13) # CHECK: :[[@LINE]]:14: error: invalid operand for instruction
|
|
|
|
swc1 $f6, -32769($13) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
|
|
|
swc1 $f6, 32768($13) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
2018-04-25 00:14:00 +08:00
|
|
|
swc1 $f6, 369($32) # CHECK: :[[@LINE]]:23: error: invalid register number
|
|
|
|
ldc2 $32, 1023($12) # CHECK: :[[@LINE]]:14: error: invalid register number
|
2016-07-11 15:41:56 +08:00
|
|
|
ldc2 $1, -32769($12) # CHECK: :[[@LINE]]:18: error: expected memory with 16-bit signed offset
|
|
|
|
ldc2 $1, 32768($12) # CHECK: :[[@LINE]]:18: error: expected memory with 16-bit signed offset
|
2018-04-25 00:14:00 +08:00
|
|
|
ldc2 $1, 1023($32) # CHECK: :[[@LINE]]:23: error: invalid register number
|
|
|
|
sdc2 $32, 8($16) # CHECK: :[[@LINE]]:14: error: invalid register number
|
2016-07-11 15:41:56 +08:00
|
|
|
sdc2 $1, -32769($16) # CHECK: :[[@LINE]]:18: error: expected memory with 16-bit signed offset
|
|
|
|
sdc2 $1, 32768($16) # CHECK: :[[@LINE]]:18: error: expected memory with 16-bit signed offset
|
2018-04-25 00:14:00 +08:00
|
|
|
sdc2 $1, 8($32) # CHECK: :[[@LINE]]:20: error: invalid register number
|
|
|
|
lwc2 $32, 16($4) # CHECK: :[[@LINE]]:14: error: invalid register number
|
2016-07-11 15:41:56 +08:00
|
|
|
lwc2 $1, -32769($4) # CHECK: :[[@LINE]]:18: error: expected memory with 16-bit signed offset
|
|
|
|
lwc2 $1, 32768($4) # CHECK: :[[@LINE]]:18: error: expected memory with 16-bit signed offset
|
2018-04-25 00:14:00 +08:00
|
|
|
lwc2 $1, 16($32) # CHECK: :[[@LINE]]:21: error: invalid register number
|
|
|
|
swc2 $32, 777($17) # CHECK: :[[@LINE]]:14: error: invalid register number
|
2016-07-11 15:41:56 +08:00
|
|
|
swc2 $1, -32769($17) # CHECK: :[[@LINE]]:18: error: expected memory with 16-bit signed offset
|
|
|
|
swc2 $1, 32768($17) # CHECK: :[[@LINE]]:18: error: expected memory with 16-bit signed offset
|
2018-04-25 00:14:00 +08:00
|
|
|
swc2 $1, 777($32) # CHECK: :[[@LINE]]:22: error: invalid register number
|
2016-07-11 15:41:56 +08:00
|
|
|
lwc2 $11, -32769($12) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
|
|
|
lwc2 $11, 32768($12) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
|
|
|
sdc2 $11, -32769($12) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
|
|
|
sdc2 $11, 32768($12) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
|
|
|
swc2 $11, -32769($12) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|
|
|
|
swc2 $11, 32768($12) # CHECK: :[[@LINE]]:19: error: expected memory with 16-bit signed offset
|