[Bug binutils/14338] New: ssat instruction saturate_to field incorrectly disassembled

2012-07-08 Thread robiniddon at googlemail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14338

 Bug #: 14338
   Summary: ssat instruction saturate_to field incorrectly
disassembled
   Product: binutils
   Version: 2.21
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
AssignedTo: unassig...@sourceware.org
ReportedBy: robinid...@googlemail.com
Classification: Unclassified


Created attachment 6517
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6517
Assembled object that disassembles incorrectly.

Assemble test-case.s:

$ cat test-case.s
.syntax unified
.arch armv7-m
.text
  ssat  r12,#16,r12

$ arm-none-eabi-gcc -march=armv7-m -mthumb -c test-case.s -o test-case.o

Now disassemble test-case.o (attached):

$ arm-none-eabi-objdump -d test-case.o

test-case.o: file format elf32-littlearm

Disassembly of section .text:

 <.text>:
   0:f30c 0c0f ssatip, #15, ip


Note that the ssat instruction encodes the saturate_to field as one less than
the target so on disassembly we ought to add one to it.  I think correct
disassembly would have been:

 <.text>:
   0:f30c 0c0f ssatip, #16, ip


This is using 2.21 - I don't have a later version available to test (x86_64,
Fedora 17 host cross compiling to ARM7-M).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/14338] ssat instruction saturate_to field incorrectly disassembled

2012-07-08 Thread robiniddon at googlemail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14338

--- Comment #1 from Robin Iddon  2012-07-08 
09:14:32 UTC ---
Created attachment 6518
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6518
Source to assemble test case.

Here is the source I used for test-case.s.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/14338] ssat instruction saturate_to field incorrectly disassembled

2012-07-08 Thread robiniddon at googlemail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14338

--- Comment #2 from Robin Iddon  2012-07-08 
09:46:08 UTC ---
I downloaded and compiled 2.22 and it has the same fault.

I've have made a very narrow patch to correct this.  I don't believe this +1
decode style is required in any other instruction so have only modified the
thumb ssat instruction.

Comments welcome on better patch - happy to address any similar cases if anyone
knows of them, for example.

Robin

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/14338] ssat instruction saturate_to field incorrectly disassembled

2012-07-08 Thread robiniddon at googlemail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14338

--- Comment #3 from Robin Iddon  2012-07-08 
09:51:03 UTC ---
Created attachment 6519
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6519
Quick fix to ssat saturate_to decode problem

I added a new field decode using %t for saturate_to field of SSAT in thumb32
instruction decoder.

This simply prints the lower 5 bits of the instruction plus one as the
saturate_to value.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils