This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] spu: make some constants unsigned


From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>

Hi,

The field in spu_opcode is unsigned, and for some values of opcode we can end
up shifting into the high bit.  So avoid possibly creating a negative number
and then assigning it to a unsigned field by shifting an unsigned constant.

built and regtested cross to spu-elf, ok?

Trev

gas/ChangeLog:

2016-05-18  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-spu.c (APUOP): Use OPCODE as an unsigned constant.
---
 gas/config/tc-spu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gas/config/tc-spu.c b/gas/config/tc-spu.c
index c08dcb5..24969c9 100644
--- a/gas/config/tc-spu.c
+++ b/gas/config/tc-spu.c
@@ -26,7 +26,7 @@
 
 const struct spu_opcode spu_opcodes[] = {
 #define APUOP(TAG,MACFORMAT,OPCODE,MNEMONIC,ASMFORMAT,DEP,PIPE) \
-	{ MACFORMAT, (OPCODE) << (32-11), MNEMONIC, ASMFORMAT },
+	{ MACFORMAT, (OPCODE ## u) << (32-11), MNEMONIC, ASMFORMAT },
 #define APUOPFB(TAG,MACFORMAT,OPCODE,FB,MNEMONIC,ASMFORMAT,DEP,PIPE) \
 	{ MACFORMAT, ((OPCODE) << (32-11)) | ((FB) << (32-18)), MNEMONIC, ASMFORMAT },
 #include "opcode/spu-insns.h"
-- 
2.7.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]