xref: /aosp_15_r20/external/llvm/test/MC/ARM/directive-arch-mode-switch.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker@ RUN: llvm-mc -triple arm-none-eabi -filetype asm %s 2>%t | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker@ RUN: FileCheck %s <%t --check-prefix=STDERR
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker@ Start in arm mode
5*9880d681SAndroid Build Coastguard Worker  .arm
6*9880d681SAndroid Build Coastguard Worker@ CHECK: .code 32
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker@ In ARM mode, switch to an arch which has ARM and Thumb, no warning or .code directive (stay in ARM mode)
9*9880d681SAndroid Build Coastguard Worker  .arch armv7-a
10*9880d681SAndroid Build Coastguard Worker@ STDERR-NOT: [[@LINE-1]]:{{[0-9]+}}: warning:
11*9880d681SAndroid Build Coastguard Worker@ CHECK-NOT: .code
12*9880d681SAndroid Build Coastguard Worker@ CHECK: .arch   armv7-a
13*9880d681SAndroid Build Coastguard Worker@ CHECK-NOT: .code
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker@ In ARM mode, switch to an arch which has Thumb only, expect warning and .code 16 directive
16*9880d681SAndroid Build Coastguard Worker  .arch armv6-m
17*9880d681SAndroid Build Coastguard Worker@ STDERR: [[@LINE-1]]:{{[0-9]+}}: warning: new target does not support arm mode, switching to thumb mode
18*9880d681SAndroid Build Coastguard Worker@ CHECK: .code   16
19*9880d681SAndroid Build Coastguard Worker@ CHECK: .arch   armv6-m
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker@ In Thumb mode, switch to an arch which has ARM and Thumb, no warning or .code directive (stay in Thumb mode)
22*9880d681SAndroid Build Coastguard Worker  .arch armv7-a
23*9880d681SAndroid Build Coastguard Worker@ STDERR-NOT: [[@LINE-1]]:{{[0-9]+}}: warning:
24*9880d681SAndroid Build Coastguard Worker@ CHECK-NOT: .code
25*9880d681SAndroid Build Coastguard Worker@ CHECK: .arch   armv7-a
26*9880d681SAndroid Build Coastguard Worker@ CHECK-NOT: .code
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker@ In Thumb mode, switch to a CPU which has ARM and Thumb, no warning or .code directive (stay in Thumb mode)
29*9880d681SAndroid Build Coastguard Worker  .cpu cortex-a8
30*9880d681SAndroid Build Coastguard Worker@ STDERR-NOT: [[@LINE-1]]:{{[0-9]+}}: warning:
31*9880d681SAndroid Build Coastguard Worker@ CHECK-NOT: .code
32*9880d681SAndroid Build Coastguard Worker@ CHECK: .cpu cortex-a8
33*9880d681SAndroid Build Coastguard Worker@ CHECK-NOT: .code
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker@ Switch to ARM mode
36*9880d681SAndroid Build Coastguard Worker  .arm
37*9880d681SAndroid Build Coastguard Worker@ CHECK: .code 32
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker@ In ARM mode, switch to a CPU which has ARM and Thumb, no warning or .code directive (stay in ARM mode)
40*9880d681SAndroid Build Coastguard Worker  .cpu cortex-a8
41*9880d681SAndroid Build Coastguard Worker@ STDERR-NOT: [[@LINE-1]]:{{[0-9]+}}: warning:
42*9880d681SAndroid Build Coastguard Worker@ CHECK-NOT: .code
43*9880d681SAndroid Build Coastguard Worker@ CHECK: .cpu cortex-a8
44*9880d681SAndroid Build Coastguard Worker@ CHECK-NOT: .code
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker@ In ARM mode, switch to a CPU which has Thumb only, expect warning and .code 16 directive
47*9880d681SAndroid Build Coastguard Worker  .cpu cortex-m3
48*9880d681SAndroid Build Coastguard Worker@ STDERR: [[@LINE-1]]:{{[0-9]+}}: warning: new target does not support arm mode, switching to thumb mode
49*9880d681SAndroid Build Coastguard Worker@ CHECK: .cpu    cortex-m3
50*9880d681SAndroid Build Coastguard Worker@ CHECK: .code   16
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Worker@ We don't have any ARM-only targets (i.e. v4), so we can't test the forced Thumb->ARM case
53