This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFA] ARM NEON: reject instructions with bad alignment
- From: Jie Zhang <jie at codesourcery dot com>
- To: binutils at sourceware dot org
- Date: Fri, 26 Feb 2010 18:15:50 +0800
- Subject: [RFA] ARM NEON: reject instructions with bad alignment
Large (128/256-bit) alignment qualifiers are only allowed on NEON
vldN/vstN instructions when the data being loaded is a multiple of those
sizes. GAS incorrectly accepts any alignment qualifier. For example the
following should be rejected:
vld1.8 {d0}, [r0, :128]
vld1.8 {q0}, [r0, :256]
With this patch, GAS will reject these two invalid instructions. Tested
GAS with arm-none-eabi target. Is it OK?
Jie
2010-02-26 Jie Zhang <jie@codesourcery.com>
gas/
* config/tc-arm.c (do_neon_ld_st_interleave): Reject bad
alignment.
gas/testsuite/
* gas/arm/neon-ldst-align-bad.d: New test.
* gas/arm/neon-ldst-align-bad.l: New test.
* gas/arm/neon-ldst-align-bad.s: New test.
Index: gas/testsuite/gas/arm/neon-ldst-align-bad.d
===================================================================
--- gas/testsuite/gas/arm/neon-ldst-align-bad.d (revision 0)
+++ gas/testsuite/gas/arm/neon-ldst-align-bad.d (revision 0)
@@ -0,0 +1,3 @@
+# name: Bad alignment in Advanced SIMD Neon instructions
+# as: -mfpu=neon
+# error-output: neon-ldst-align-bad.l
Index: gas/testsuite/gas/arm/neon-ldst-align-bad.l
===================================================================
--- gas/testsuite/gas/arm/neon-ldst-align-bad.l (revision 0)
+++ gas/testsuite/gas/arm/neon-ldst-align-bad.l (revision 0)
@@ -0,0 +1,3 @@
+[^:]*: Assembler messages:
+[^:]*:1: Error: bad alignment -- `vld1.8 {d0},\[r0,:128\]'
+[^:]*:2: Error: bad alignment -- `vld1.8 {q0},\[r0,:256\]'
Index: gas/testsuite/gas/arm/neon-ldst-align-bad.s
===================================================================
--- gas/testsuite/gas/arm/neon-ldst-align-bad.s (revision 0)
+++ gas/testsuite/gas/arm/neon-ldst-align-bad.s (revision 0)
@@ -0,0 +1,2 @@
+vld1.8 {d0}, [r0, :128]
+vld1.8 {q0}, [r0, :256]
Index: gas/config/tc-arm.c
===================================================================
--- gas/config/tc-arm.c (revision 276631)
+++ gas/config/tc-arm.c (working copy)
@@ -14568,12 +14568,13 @@ do_neon_ld_st_interleave (void)
{
case 64: alignbits = 1; break;
case 128:
- if (NEON_REGLIST_LENGTH (inst.operands[0].imm) == 3)
+ if (NEON_REGLIST_LENGTH (inst.operands[0].imm) != 2
+ && NEON_REGLIST_LENGTH (inst.operands[0].imm) != 4)
goto bad_alignment;
alignbits = 2;
break;
case 256:
- if (NEON_REGLIST_LENGTH (inst.operands[0].imm) == 3)
+ if (NEON_REGLIST_LENGTH (inst.operands[0].imm) != 4)
goto bad_alignment;
alignbits = 3;
break;