diff options
| author | Oliver Stannard <oliver.stannard@arm.com> | 2014-11-05 12:06:39 +0000 |
|---|---|---|
| committer | Oliver Stannard <oliver.stannard@arm.com> | 2014-11-05 12:06:39 +0000 |
| commit | 9e89d8cc5cd048b5ed2037f472f3d38ce2c8328f (patch) | |
| tree | 885f70aaf959a2338916c3c23aee98c8bea4614d /llvm/test | |
| parent | e20ce07a2fa6c447872da3f8230c08e46166d9e3 (diff) | |
| download | bcm5719-llvm-9e89d8cc5cd048b5ed2037f472f3d38ce2c8328f.tar.gz bcm5719-llvm-9e89d8cc5cd048b5ed2037f472f3d38ce2c8328f.zip | |
[ARM] Honor FeatureD16 in the assembler and disassembler
Some ARM FPUs only have 16 double-precision registers, rather than the
normal 32. LLVM represents this with the D16 target feature. This is
currently used by CodeGen to avoid using high registers when they are
not available, but the assembler and disassembler do not.
I fix this in the assmebler and disassembler rather than the
InstrInfo.td files, as the latter would require a large number of
changes everywhere one of the floating-point instructions is referenced
in the backend. This solution is similar to the one used for
co-processor numbers and MSR masks.
llvm-svn: 221341
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/MC/ARM/d16.s | 24 | ||||
| -rw-r--r-- | llvm/test/MC/ARM/directive-fpu-instrs.s | 2 | ||||
| -rw-r--r-- | llvm/test/MC/ARM/vfp4.s | 12 | ||||
| -rw-r--r-- | llvm/test/MC/Disassembler/ARM/d16.txt | 23 |
4 files changed, 54 insertions, 7 deletions
diff --git a/llvm/test/MC/ARM/d16.s b/llvm/test/MC/ARM/d16.s new file mode 100644 index 00000000000..40abbfb4793 --- /dev/null +++ b/llvm/test/MC/ARM/d16.s @@ -0,0 +1,24 @@ +@ RUN: llvm-mc < %s -triple thumbv7-unknown-unknown -show-encoding -mattr=+vfp4,-d16 |& FileCheck %s --check-prefix=D32 +@ RUN: not llvm-mc < %s -triple thumbv7-unknown-unknown -show-encoding -mattr=+vfp4,+d16 |& FileCheck %s --check-prefix=D16 + +@ D32-NOT: error: + +@ D16: invalid operand for instruction +@ D16-NEXT: vadd.f64 d1, d2, d16 +vadd.f64 d1, d2, d16 + +@ D16: invalid operand for instruction +@ D16-NEXT: vadd.f64 d1, d17, d6 +vadd.f64 d1, d17, d6 + +@ D16: invalid operand for instruction +@ D16-NEXT: vadd.f64 d19, d7, d6 +vadd.f64 d19, d7, d6 + +@ D16: invalid operand for instruction +@ D16-NEXT: vcvt.f64.f32 d22, s4 +vcvt.f64.f32 d22, s4 + +@ D16: invalid operand for instruction +@ D16-NEXT: vcvt.f32.f64 s26, d30 +vcvt.f32.f64 s26, d30 diff --git a/llvm/test/MC/ARM/directive-fpu-instrs.s b/llvm/test/MC/ARM/directive-fpu-instrs.s index 0b1e8cc3528..ec97a77aef6 100644 --- a/llvm/test/MC/ARM/directive-fpu-instrs.s +++ b/llvm/test/MC/ARM/directive-fpu-instrs.s @@ -1,4 +1,4 @@ -// RUN: llvm-mc -triple armv7-unknown-linux-gnueabi -mattr=+vfp3,+d16,-neon %s +// RUN: llvm-mc -triple armv7-unknown-linux-gnueabi -mattr=+vfp3,-neon %s .fpu neon VAND d3, d5, d5 diff --git a/llvm/test/MC/ARM/vfp4.s b/llvm/test/MC/ARM/vfp4.s index 8b1b0e0c538..1563b5aef71 100644 --- a/llvm/test/MC/ARM/vfp4.s +++ b/llvm/test/MC/ARM/vfp4.s @@ -6,7 +6,7 @@ @ ARM: vfma.f64 d16, d18, d17 @ encoding: [0xa1,0x0b,0xe2,0xee] @ THUMB: vfma.f64 d16, d18, d17 @ encoding: [0xe2,0xee,0xa1,0x0b] -@ THUMB_V7EM-ERRORS: error: instruction requires: double precision VFP +@ THUMB_V7EM-ERRORS: error: invalid operand for instruction @ THUMB_V7EM-ERRORS-NEXT: vfma.f64 d16, d18, d17 vfma.f64 d16, d18, d17 @@ -17,7 +17,7 @@ vfma.f32 s2, s4, s0 @ ARM: vfma.f32 d16, d18, d17 @ encoding: [0xb1,0x0c,0x42,0xf2] @ THUMB: vfma.f32 d16, d18, d17 @ encoding: [0x42,0xef,0xb1,0x0c] -@ THUMB_V7EM-ERRORS: error: instruction requires: NEON +@ THUMB_V7EM-ERRORS: error: invalid operand for instruction @ THUMB_V7EM-ERRORS-NEXT: vfma.f32 d16, d18, d17 vfma.f32 d16, d18, d17 @@ -29,7 +29,7 @@ vfma.f32 q2, q4, q0 @ ARM: vfnma.f64 d16, d18, d17 @ encoding: [0xe1,0x0b,0xd2,0xee] @ THUMB: vfnma.f64 d16, d18, d17 @ encoding: [0xd2,0xee,0xe1,0x0b] -@ THUMB_V7EM-ERRORS: error: instruction requires: double precision VFP +@ THUMB_V7EM-ERRORS: error: invalid operand for instruction @ THUMB_V7EM-ERRORS-NEXT: vfnma.f64 d16, d18, d17 vfnma.f64 d16, d18, d17 @@ -40,7 +40,7 @@ vfnma.f32 s2, s4, s0 @ ARM: vfms.f64 d16, d18, d17 @ encoding: [0xe1,0x0b,0xe2,0xee] @ THUMB: vfms.f64 d16, d18, d17 @ encoding: [0xe2,0xee,0xe1,0x0b] -@ THUMB_V7EM-ERRORS: error: instruction requires: double precision VFP +@ THUMB_V7EM-ERRORS: error: invalid operand for instruction @ THUMB_V7EM-ERRORS-NEXT: vfms.f64 d16, d18, d17 vfms.f64 d16, d18, d17 @@ -51,7 +51,7 @@ vfms.f32 s2, s4, s0 @ ARM: vfms.f32 d16, d18, d17 @ encoding: [0xb1,0x0c,0x62,0xf2] @ THUMB: vfms.f32 d16, d18, d17 @ encoding: [0x62,0xef,0xb1,0x0c] -@ THUMB_V7EM-ERRORS: error: instruction requires: NEON +@ THUMB_V7EM-ERRORS: error: invalid operand for instruction @ THUMB_V7EM-ERRORS-NEXT: vfms.f32 d16, d18, d17 vfms.f32 d16, d18, d17 @@ -63,7 +63,7 @@ vfms.f32 q2, q4, q0 @ ARM: vfnms.f64 d16, d18, d17 @ encoding: [0xa1,0x0b,0xd2,0xee] @ THUMB: vfnms.f64 d16, d18, d17 @ encoding: [0xd2,0xee,0xa1,0x0b] -@ THUMB_V7EM-ERRORS: error: instruction requires: double precision VFP +@ THUMB_V7EM-ERRORS: error: invalid operand for instruction @ THUMB_V7EM-ERRORS-NEXT: vfnms.f64 d16, d18, d17 vfnms.f64 d16, d18, d17 diff --git a/llvm/test/MC/Disassembler/ARM/d16.txt b/llvm/test/MC/Disassembler/ARM/d16.txt new file mode 100644 index 00000000000..42560e19b39 --- /dev/null +++ b/llvm/test/MC/Disassembler/ARM/d16.txt @@ -0,0 +1,23 @@ +# RUN: llvm-mc < %s -triple thumbv7-unknown-unknown -disassemble -mattr=+vfp4,-d16 |& FileCheck %s --check-prefix=D32 +# RUN: llvm-mc < %s -triple thumbv7-unknown-unknown -disassemble -mattr=+vfp4,-d16 |& FileCheck %s --check-prefix=D32 + + +# D32: vadd.f64 d1, d2, d16 +# D16: warning: invalid instruction encoding +[0x32,0xee,0x20,0x1b] + +# D32: vadd.f64 d1, d17, d6 +# D16: warning: invalid instruction encoding +[0x31,0xee,0x86,0x1b] + +# D32: vadd.f64 d19, d7, d6 +# D16: warning: invalid instruction encoding +[0x77,0xee,0x06,0x3b] + +# D32: vcvt.f64.f32 d22, s4 +# D16: warning: invalid instruction encoding +[0xf7,0xee,0xc2,0x6a] + +# D32: vcvt.f32.f64 s26, d30 +# D16: warning: invalid instruction encoding +[0xb7,0xee,0xee,0xdb] |

