From 5d4c71e1273480dd7ced19e193649093b30f1bd1 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Thu, 7 Oct 2010 11:28:49 +0000 Subject: [PATCH] gas/ * config/tc-tic6x.c (tic6x_try_encode): Correct encoding of fstg field in SPKERNEL instructions. opcodes/ * tic6x-dis.c (print_insn_tic6x): Correct decoding of fstg field in SPKERNEL instructions. gas/testsuite/ * gas/tic6x/insns-c674x-sploop.d: Add two more sploop/spkernel tests. * gas/tic6x/insns-c674x-sploop.s: Likewise. --- gas/ChangeLog | 5 +++++ gas/config/tc-tic6x.c | 9 ++++++++- gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/tic6x/insns-c674x-sploop.d | 6 ++++++ gas/testsuite/gas/tic6x/insns-c674x-sploop.s | 6 ++++++ opcodes/ChangeLog | 5 +++++ opcodes/tic6x-dis.c | 6 ++++-- 7 files changed, 39 insertions(+), 3 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 6031f59536..ad16b9e3a6 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2010-10-07 Bernd Schmidt + + * config/tc-tic6x.c (tic6x_try_encode): Correct encoding of fstg field + in SPKERNEL instructions. + 2010-10-06 Nathan Sidwell * config/tc-arm.c (encode_branch): Remove superfluous braces. diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index f1c28d0d3c..c706158bd7 100644 --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -2503,6 +2503,7 @@ tic6x_try_encode (tic6x_opcode_id id, tic6x_operand *operands, if (opct->variable_fields[fld].coding_method == tic6x_coding_fstg) { + int i, t; if (operands[opno].value.exp.X_add_number < 0 || (operands[opno].value.exp.X_add_number >= (1 << (fldd->width - fcyc_bits)))) @@ -2513,7 +2514,13 @@ tic6x_try_encode (tic6x_opcode_id id, tic6x_operand *operands, *ok = FALSE; return 0; } - value = operands[opno].value.exp.X_add_number << fcyc_bits; + value = operands[opno].value.exp.X_add_number; + for (t = 0, i = fcyc_bits; i < fldd->width; i++) + { + t = (t << 1) | (value & 1); + value >>= 1; + } + value = t << fcyc_bits; } else { diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 8d2f8527e6..3bed86b5e7 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-10-07 Bernd Schmidt + + * gas/tic6x/insns-c674x-sploop.d: Add two more sploop/spkernel tests. + * gas/tic6x/insns-c674x-sploop.s: Likewise. + 2010-10-04 David Daney * gas/mips/mips.exp (octeon-pref): Run the new test. diff --git a/gas/testsuite/gas/tic6x/insns-c674x-sploop.d b/gas/testsuite/gas/tic6x/insns-c674x-sploop.d index cd383b6478..63e4fb1eef 100644 --- a/gas/testsuite/gas/tic6x/insns-c674x-sploop.d +++ b/gas/testsuite/gas/tic6x/insns-c674x-sploop.d @@ -77,4 +77,10 @@ Disassembly of section \.text: [0-9a-f]+[048c] <[^>]*> 06838000[ \t]+sploop 14 [0-9a-f]+[048c] <[^>]*> 00000000[ \t]+nop 1 [0-9a-f]+[048c] <[^>]*> 0f434000[ \t]+spkernel 3,13 +[0-9a-f]+[048c] <[^>]*> 00038000[ \t]+sploop 1 +[0-9a-f]+[048c] <[^>]*> 00000000[ \t]+nop 1 +[0-9a-f]+[048c] <[^>]*> 01034000[ \t]+spkernel 8,0 +[0-9a-f]+[048c] <[^>]*> 00838000[ \t]+sploop 2 [0-9a-f]+[048c] <[^>]*> 00000000[ \t]+nop 1 +[0-9a-f]+[048c] <[^>]*> 06034000[ \t]+spkernel 6,0 +[ \t]*\.\.\. diff --git a/gas/testsuite/gas/tic6x/insns-c674x-sploop.s b/gas/testsuite/gas/tic6x/insns-c674x-sploop.s index 95a6745287..85bd6a45f0 100644 --- a/gas/testsuite/gas/tic6x/insns-c674x-sploop.s +++ b/gas/testsuite/gas/tic6x/insns-c674x-sploop.s @@ -77,3 +77,9 @@ f: sploop 14 nop spkernel 3,13 + sploop 1 + nop + spkernel 8,0 + sploop 2 + nop + spkernel 6,0 diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 5c964ed9c8..fe700ede47 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2010-10-07 Bernd Schmidt + + * tic6x-dis.c (print_insn_tic6x): Correct decoding of fstg field + in SPKERNEL instructions. + 2010-10-02 H.J. Lu PR binutils/12076 diff --git a/opcodes/tic6x-dis.c b/opcodes/tic6x-dis.c index 8032084877..86505ac54d 100644 --- a/opcodes/tic6x-dis.c +++ b/opcodes/tic6x-dis.c @@ -882,9 +882,11 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info) abort (); if (enc->coding_method == tic6x_coding_fstg) { + int i, t; + for (t = 0, i = fcyc_bits; i < 6; i++) + t = (t << 1) | ((fld_val >> i) & 1); operands_text[op_num] = TRUE; - snprintf (operands[op_num], 24, "%u", - fld_val >> fcyc_bits); + snprintf (operands[op_num], 24, "%u", t); } else { -- 2.34.1