From bc2d180888f7f4efabce7eccf95088a540bc4fcb Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 15 Jan 2009 12:33:46 +0000 Subject: [PATCH] PR 9722 * config/tc-arm.c (do_t_nop): Check for availability of Thumb2 instructions before generating a Thumb2 nop. * gas/testsuite/gas/arm/archv6m.d: Update expected NOP opcode. * gas/testsuite/gas/arm/pr9722.s: New test. * gas/testsuite/gas/arm/pr9722.d: Expected disassembly. --- gas/ChangeLog | 6 ++++++ gas/config/tc-arm.c | 11 +++++++++-- gas/testsuite/ChangeLog | 7 +++++++ gas/testsuite/gas/arm/archv6m.d | 2 +- gas/testsuite/gas/arm/pr9722.d | 10 ++++++++++ gas/testsuite/gas/arm/pr9722.s | 8 ++++++++ 6 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 gas/testsuite/gas/arm/pr9722.d create mode 100644 gas/testsuite/gas/arm/pr9722.s diff --git a/gas/ChangeLog b/gas/ChangeLog index fb0b41448de..60b69056124 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2009-01-15 Nick Clifton + + PR 9722 + * config/tc-arm.c (do_t_nop): Check for availability of Thumb2 + instructions before generating a Thumb2 nop. + 2009-01-14 Andreas Krebbel * config/tc-s390.h: Define LOCAL_LABEL_PREFIX. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 37f81128578..5998e5555ba 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -9927,8 +9927,15 @@ do_t_nop (void) } else { - inst.instruction = THUMB_OP16 (inst.instruction); - inst.instruction |= inst.operands[0].imm << 4; + /* PR9722: Check for Thumb2 availability before + generating a thumb2 nop instruction. */ + if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_arch_t2)) + { + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].imm << 4; + } + else + inst.instruction = 0x46c0; } } else diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index eddb6994db3..fd201a3f824 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2009-01-15 Nick Clifton + + PR 9722 + * gas/testsuite/gas/arm/archv6m.d: Update expected NOP opcode. + * gas/testsuite/gas/arm/pr9722.s: New test. + * gas/testsuite/gas/arm/pr9722.d: Expected disassembly. + 2009-01-14 Peter Bergner * gas/ppc/power6.s ("mtfsf", "mtfsf.", "mtfsfi", "mtfsfi."): Add tests. diff --git a/gas/testsuite/gas/arm/archv6m.d b/gas/testsuite/gas/arm/archv6m.d index b6ef1e616b3..31d06a31584 100644 --- a/gas/testsuite/gas/arm/archv6m.d +++ b/gas/testsuite/gas/arm/archv6m.d @@ -12,4 +12,4 @@ Disassembly of section .text: 0[0-9a-f]+ <[^>]+> bf30 wfi 0[0-9a-f]+ <[^>]+> bf40 sev 0[0-9a-f]+ <[^>]+> 4408 add r0, r1 -0[0-9a-f]+ <[^>]+> bf00 nop +0[0-9a-f]+ <[^>]+> 46c0 nop.* diff --git a/gas/testsuite/gas/arm/pr9722.d b/gas/testsuite/gas/arm/pr9722.d new file mode 100644 index 00000000000..44f7e48d4e1 --- /dev/null +++ b/gas/testsuite/gas/arm/pr9722.d @@ -0,0 +1,10 @@ +#skip: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* *-*-vxworks +#objdump: -dr --prefix-addresses --show-raw-insn +#name: PR9722: Generation of Thumb NOP instruction + +.*: +file format .*arm.* + +Disassembly of section .text: +0+0 <.*> 46c0[ ]+nop.* +0+2 <.*> 46c0[ ]+nop.* +0+4 <.*> bf00[ ]+nop diff --git a/gas/testsuite/gas/arm/pr9722.s b/gas/testsuite/gas/arm/pr9722.s new file mode 100644 index 00000000000..0d54d3a9ffa --- /dev/null +++ b/gas/testsuite/gas/arm/pr9722.s @@ -0,0 +1,8 @@ + .thumb + .text + .arch armv4t + nop + .syntax unified + nop + .arch armv6t2 + nop -- 2.30.2