This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] spu: make some constants unsigned
- From: Trevor Saunders <tbsaunde at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 23 May 2016 05:14:51 -0000
- Subject: [binutils-gdb] spu: make some constants unsigned
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2900e701e0f0216b17e04e4fff1ca4711a9c072f
commit 2900e701e0f0216b17e04e4fff1ca4711a9c072f
Author: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
Date: Wed May 18 22:39:18 2016 -0400
spu: make some constants unsigned
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.
gas/ChangeLog:
2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-spu.c (APUOP): Use OPCODE as an unsigned constant.
Diff:
---
gas/ChangeLog | 4 ++++
gas/config/tc-spu.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 20c8702..6809c67 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,9 @@
2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+ * config/tc-spu.c (APUOP): Use OPCODE as an unsigned constant.
+
+2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+
* config/tc-tic54x.c (tic54x_mmregs): Adjust.
(md_begin): Likewise.
(encode_condition): Likewise.
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"