Bug 10168 - Wrong machine code for Thumb2 instruction PKHTB
Summary: Wrong machine code for Thumb2 instruction PKHTB
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.19
: P3 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-18 13:02 UTC by Anthony Fox
Modified: 2009-07-01 16:37 UTC (History)
1 user (show)

See Also:
Host: i386-redhat-linux
Target: arm-elf
Build:
Last reconfirmed:


Attachments
Fix opcode generation and testsuite (592 bytes, patch)
2009-07-01 16:33 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Fox 2009-05-18 13:02:59 UTC
The ARM Thumb2 pseudo-instruction

PKHTB<c> <Rd>,<Rm>,<Rn>

should be assembled through

PKHBT<c> <Rd>,<Rm>,<Rn>

but is instead assembled through

PKHBT<c> <Rd>,<Rn>,<Rm>

For example:

$ echo ".code 16 pkhtb r1,r2,r3" | arm-elf-as -aln -EB -o /dev/null
   1 0000 EAC20103      .code 16 pkhtb r1,r2,r3

$ echo ".code 16 pkhbt r1,r2,r3" | arm-elf-as -aln -EB -o /dev/null
   1 0000 EAC20103      .code 16 pkhbt r1,r2,r3
Comment 1 Anthony Fox 2009-05-18 13:09:51 UTC
That should be

"The ARM Thumb2 pseudo-instruction

PKHTB<c> <Rd>,<Rn>,<Rm>

..."
Comment 2 Nick Clifton 2009-07-01 16:33:00 UTC
Created attachment 4034 [details]
Fix opcode generation and testsuite
Comment 3 Sourceware Commits 2009-07-01 16:36:44 UTC
Subject: Bug 10168

CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2009-07-01 16:36:29

Modified files:
	gas            : ChangeLog 
	gas/config     : tc-arm.c 
	gas/doc        : as.texinfo 
	gas/testsuite  : ChangeLog 
	gas/testsuite/gas/arm: thumb32.d 

Log message:
	PR 10168
	* config/tc-arm.c (do_t_pkhtb): Swap Rm and Rn when encoding as
	PKHBT.
	* gas/arm/thumb32.d: Fix expected disassembly of PKHTB insn.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.3837&r2=1.3838
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=src&r1=1.390&r2=1.391
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/doc/as.texinfo.diff?cvsroot=src&r1=1.204&r2=1.205
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1499&r2=1.1500
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/thumb32.d.diff?cvsroot=src&r1=1.32&r2=1.33

Comment 4 Nick Clifton 2009-07-01 16:37:36 UTC
Hi Anthony,

  Thanks for reporting this bug.  I have checked in the uploaded patch to fix
the problem and adjust the gas testsuite to take the change into account.

Cheers
  Nick

gas/ChangeLog
	PR 10168
	* config/tc-arm.c (do_t_pkhtb): Swap Rm and Rn when encoding as
	PKHBT.

gas/testsuite/ChangeLog
	PR 10168
	* gas/arm/thumb32.d: Fix expected disassembly of PKHTB insn.