Bug 10169 - Fails to report a bad shift value for Thumb2 instructions SSAT and USAT
Summary: Fails to report a bad shift value for Thumb2 instructions SSAT and USAT
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:19 UTC by Anthony Fox
Modified: 2009-06-18 16:35 UTC (History)
1 user (show)

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


Attachments
Catch out of range shift values for SSAT and USAT instructions. (1.33 KB, patch)
2009-06-18 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:19:42 UTC
The ARM Thumb2 assembly code

SSAT<c> <Rd>,#<imm>,<Rn>,ASR #32

and

USAT<c> <Rd>,#<imm>,<Rn>,ASR #32

should produce an error (these are only valid when not in Thumb mode).

They instead compile to

SSAT16<c> <Rd>,#<imm>,<Rn>

and

USAT16<c> <Rd>,#<imm>,<Rn>

For example:

$ echo ".code 16 ssat r1,#2,r3,asr #32" | arm-elf-as -aln -EB -o /dev/null
   1 0000 F3230101      .code 16 ssat r1,#2,r3,asr#32

$ echo ".code 16 ssat16 r1,#2,r3" | arm-elf-as -aln -EB -o /dev/null
   1 0000 F3230101      .code 16 ssat16 r1,#2,r3

$ echo ".code 16 usat r1,#2,r3,asr #32" | arm-elf-as -aln -EB -o /dev/null
   1 0000 F3A30102      .code 16 usat r1,#2,r3,asr#32

$ echo ".code 16 usat16 r1,#2,r3" | arm-elf-as -aln -EB -o /dev/null
   1 0000 F3A30102      .code 16 usat16 r1,#2,r3
Comment 1 Nick Clifton 2009-06-18 16:33:36 UTC
Created attachment 4007 [details]
Catch out of range shift values for SSAT and USAT instructions.
Comment 2 Nick Clifton 2009-06-18 16:35:11 UTC
Hi Anthony,

  Thank you for reporting this bug.  I am going to apply the uploaded patch to
fix the assembler and also a test case for the erroneous instructions.

Cheers
  Nick

gas/ChangeLog
2009-06-18  Nick Clifton  <nickc@redhat.com>

	PR 10169
	* gas/tc-arm.c (do_t_ssat): Move common code from here...
	(do_t_usat): ... and here to...
	(do_t_ssat_usat): New function: ... here.  Add code to check that
	the shift value, if present, is in range.

gas/testsuite/ChangeLog
2009-06-18  Nick Clifton  <nickc@redhat.com>

	PR 10169
	* gas/arm/thumb2_bad_reg.s: Add tests for SSAT and USAT with an
	out of range shift.
	* gas/arm/thumb2_bad_reg.l: Update expected error messages.

Comment 3 Sourceware Commits 2009-06-18 16:36:24 UTC
Subject: Bug 10169

CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2009-06-18 16:36:05

Modified files:
	gas/config     : tc-arm.c 
	gas            : ChangeLog 
	gas/testsuite  : ChangeLog 
	gas/testsuite/gas/arm: thumb2_bad_reg.l thumb2_bad_reg.s 

Log message:
	PR 10169
	* gas/tc-arm.c (do_t_ssat): Move common code from here...
	(do_t_usat): ... and here to...
	(do_t_ssat_usat): New function: ... here.  Add code to check that
	the shift value, if present, is in range.
	
	* gas/arm/thumb2_bad_reg.s: Add tests for SSAT and USAT with an
	out of range shift.
	* gas/arm/thumb2_bad_reg.l: Update expected error messages.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=src&r1=1.386&r2=1.387
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.3829&r2=1.3830
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1493&r2=1.1494
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/thumb2_bad_reg.l.diff?cvsroot=src&r1=1.2&r2=1.3
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/thumb2_bad_reg.s.diff?cvsroot=src&r1=1.2&r2=1.3