[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: aarch64_logical_immediate_p
From: |
nick clifton |
Subject: |
Re: aarch64_logical_immediate_p |
Date: |
Wed, 28 Aug 2013 11:24:47 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:23.0) Gecko/20100101 Firefox/23.0 SeaMonkey/2.20 |
Hi D.Sturm,
I don't understand how the following code in aarch64_logical_immediate_p
works:
if (is32)
{
/* Allow all zeros or all ones in top 32-bits, so that
constant expressions like ~1 are permitted. */
if (value >> 32 != 0 && value >> 32 != 0xffffffff)
return 0xffffffff;
Why are we returning a true value here? (and why such a strange choice?)
And that without even setting the aarch64_insn *encoding - this seems like
a bug to me or I'm misunderstanding the code.
Nope - you are right - it is a bug.
I have checked in the patch below to fix the code to return FALSE and to
add a test case to the assembler test suite to make sure that we
generate an error message.
Cheers
Nick
opcodes/ChangeLog
2013-08-28 Nick Clifton <address@hidden>
* aarch64-opc.c (aarch64_logical_immediate_p): Return FALSE if the
immediate is not suitable for the 32-bit ABI.
gas/testsuite/ChangeLog
2013-08-28 Nick Clifton <address@hidden>
* gas/aarch64/illegal.s: Add illegal constant for logical
operation.
* gas/aarch64/illegal.l: Add expected error message.
Index: opcodes/aarch64-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/aarch64-opc.c,v
retrieving revision 1.8
diff -u -3 -p -r1.8 aarch64-opc.c
--- opcodes/aarch64-opc.c 13 May 2013 22:28:27 -0000 1.8
+++ opcodes/aarch64-opc.c 28 Aug 2013 10:24:48 -0000
@@ -1063,7 +1063,8 @@ aarch64_logical_immediate_p (uint64_t va
/* Allow all zeros or all ones in top 32-bits, so that
constant expressions like ~1 are permitted. */
if (value >> 32 != 0 && value >> 32 != 0xffffffff)
- return 0xffffffff;
+ return FALSE;
+
/* Replicate the 32 lower bits to the 32 upper bits. */
value &= 0xffffffff;
value |= value << 32;
Index: gas/testsuite/gas/aarch64/illegal.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/aarch64/illegal.s,v
retrieving revision 1.4
diff -u -3 -p -r1.4 illegal.s
--- gas/testsuite/gas/aarch64/illegal.s 5 Mar 2013 16:31:44 -0000 1.4
+++ gas/testsuite/gas/aarch64/illegal.s 28 Aug 2013 10:24:48 -0000
@@ -547,4 +547,7 @@
// No 16-byte relocation
ldr q0, =one_label
+ ands w0, w24, #0xffeefffffffffffd
+
one_label:
+
Index: gas/testsuite/gas/aarch64/illegal.l
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/aarch64/illegal.l,v
retrieving revision 1.5
diff -u -3 -p -r1.5 illegal.l
--- gas/testsuite/gas/aarch64/illegal.l 5 Mar 2013 16:31:44 -0000 1.5
+++ gas/testsuite/gas/aarch64/illegal.l 28 Aug 2013 10:24:48 -0000
@@ -551,4 +551,5 @@
[^:]*:543: Error: .*`fmov s0,#0x11'
[^:]*:544: Error: .*`fmov s0,#0xC0280000C1400000'
[^:]*:545: Error: .*`fmov d0,#0xC02f800000000000'
-[^:]*:550: Error: .*
+[^:]*:550: Error: .*`ands w0,w24,#0xffeefffffffffffd'
+[^:]*:553: Error: .*