diff options
author | Tim Northover <tnorthover@apple.com> | 2013-06-10 23:20:58 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2013-06-10 23:20:58 +0000 |
commit | 9bdd78501484a1add2d8a757fd29960dd9fc9de7 (patch) | |
tree | a0de733750c030b3280711231515852051a38bcc /test | |
parent | 45dec48dc3725a8e5ca5cfdeeed941eea2e456f1 (diff) | |
download | external_llvm-9bdd78501484a1add2d8a757fd29960dd9fc9de7.zip external_llvm-9bdd78501484a1add2d8a757fd29960dd9fc9de7.tar.gz external_llvm-9bdd78501484a1add2d8a757fd29960dd9fc9de7.tar.bz2 |
ARM: diagnose ARM/Thumb assembly switches on CPUs only supporting one.
Some ARM CPUs only support ARM mode (ancient v4 ones, for example) and some
only support Thumb mode (M-class ones currently). This makes sure such CPUs
default to the correct mode and makes the AsmParser diagnose an attempt to
switch modes incorrectly.
rdar://14024354
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/MC/ARM/arm-thumb-cpus-default.s | 13 | ||||
-rw-r--r-- | test/MC/ARM/arm-thumb-cpus.s | 20 | ||||
-rw-r--r-- | test/MC/ARM/elf-thumbfunc-reloc.s | 2 | ||||
-rw-r--r-- | test/MC/ARM/mapping-within-section.s | 2 | ||||
-rw-r--r-- | test/MC/ARM/multi-section-mapping.s | 2 |
5 files changed, 36 insertions, 3 deletions
diff --git a/test/MC/ARM/arm-thumb-cpus-default.s b/test/MC/ARM/arm-thumb-cpus-default.s new file mode 100644 index 0000000..636ee3c --- /dev/null +++ b/test/MC/ARM/arm-thumb-cpus-default.s @@ -0,0 +1,13 @@ +@ RUN: llvm-mc -show-encoding -arch=arm < %s | FileCheck %s --check-prefix=CHECK-ARM-ONLY +@ RUN: llvm-mc -show-encoding -triple=armv4t < %s | FileCheck %s --check-prefix=CHECK-ARM-THUMB +@ RUN: llvm-mc -show-encoding -arch=arm -mcpu=cortex-a15 < %s| FileCheck %s --check-prefix=CHECK-ARM-THUMB +@ RUN: llvm-mc -show-encoding -arch=arm -mcpu=cortex-m3 < %s | FileCheck %s --check-prefix=CHECK-THUMB-ONLY +@ RUN: llvm-mc -show-encoding -triple=armv7m < %s | FileCheck %s --check-prefix=CHECK-THUMB-ONLY +@ RUN: llvm-mc -show-encoding -triple=armv6m < %s | FileCheck %s --check-prefix=CHECK-THUMB-ONLY + + @ Make sure the architecture chosen by LLVM defaults to a compatible + @ ARM/Thumb mode. + movs r0, r0 +@ CHECK-ARM-THUMB: movs r0, r0 @ encoding: [0x00,0x00,0xb0,0xe1] +@ CHECK-ARM-ONLY: movs r0, r0 @ encoding: [0x00,0x00,0xb0,0xe1] +@ CHECK-THUMB-ONLY: movs r0, r0 @ encoding: [0x00,0x00] diff --git a/test/MC/ARM/arm-thumb-cpus.s b/test/MC/ARM/arm-thumb-cpus.s new file mode 100644 index 0000000..c15e807 --- /dev/null +++ b/test/MC/ARM/arm-thumb-cpus.s @@ -0,0 +1,20 @@ +@ RUN: llvm-mc -show-encoding -arch=arm < %s 2>&1 | FileCheck %s --check-prefix=CHECK-ARM-ONLY +@ RUN: llvm-mc -show-encoding -triple=armv4t < %s 2>&1| FileCheck %s --check-prefix=CHECK-ARM-THUMB +@ RUN: llvm-mc -show-encoding -arch=arm -mcpu=cortex-a15 < %s 2>&1| FileCheck %s --check-prefix=CHECK-ARM-THUMB +@ RUN: llvm-mc -show-encoding -arch=arm -mcpu=cortex-m3 < %s 2>&1 | FileCheck %s --check-prefix=CHECK-THUMB-ONLY +@ RUN: llvm-mc -show-encoding -triple=armv7m < %s 2>&1 | FileCheck %s --check-prefix=CHECK-THUMB-ONLY +@ RUN: llvm-mc -show-encoding -triple=armv6m < %s 2>&1 | FileCheck %s --check-prefix=CHECK-THUMB-ONLY + + @ Make sure correct diagnostics are given for CPUs without support for + @ one or other of the execution states. + .thumb + .arm + .code 16 + .code 32 +@ CHECK-ARM-THUMB-NOT: target does not support + +@ CHECK-ARM-ONLY: target does not support Thumb mode +@ CHECK-ARM-ONLY: target does not support Thumb mode + +@ CHECK-THUMB-ONLY: target does not support ARM mode +@ CHECK-THUMB-ONLY: target does not support ARM mode diff --git a/test/MC/ARM/elf-thumbfunc-reloc.s b/test/MC/ARM/elf-thumbfunc-reloc.s index de3594e..6147020 100644 --- a/test/MC/ARM/elf-thumbfunc-reloc.s +++ b/test/MC/ARM/elf-thumbfunc-reloc.s @@ -1,5 +1,5 @@ @@ test st_value bit 0 of thumb function -@ RUN: llvm-mc %s -triple=arm-freebsd-eabi -filetype=obj -o - | \ +@ RUN: llvm-mc %s -triple=armv4t-freebsd-eabi -filetype=obj -o - | \ @ RUN: llvm-readobj -r | FileCheck %s diff --git a/test/MC/ARM/mapping-within-section.s b/test/MC/ARM/mapping-within-section.s index 56dd6ef..b1379d2 100644 --- a/test/MC/ARM/mapping-within-section.s +++ b/test/MC/ARM/mapping-within-section.s @@ -1,4 +1,4 @@ -@ RUN: llvm-mc -triple=arm-linux-gnueabi -filetype=obj < %s | llvm-objdump -t - | FileCheck %s +@ RUN: llvm-mc -triple=armv7-linux-gnueabi -filetype=obj < %s | llvm-objdump -t - | FileCheck %s .text @ $a at 0x0000 diff --git a/test/MC/ARM/multi-section-mapping.s b/test/MC/ARM/multi-section-mapping.s index f7c4e89..2b1b0ef 100644 --- a/test/MC/ARM/multi-section-mapping.s +++ b/test/MC/ARM/multi-section-mapping.s @@ -1,4 +1,4 @@ -@ RUN: llvm-mc -triple=arm-linux-gnueabi -filetype=obj < %s | llvm-objdump -t - | FileCheck %s +@ RUN: llvm-mc -triple=armv7-linux-gnueabi -filetype=obj < %s | llvm-objdump -t - | FileCheck %s .text add r0, r0, r0 |