Skip to content

Commit f1c7f42

Browse files
committed
[binutils, ARM, 7/16] New BFX and BFLX instruction for Armv8.1-M Mainline
This patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils. This patch adds the BFX and BFLX instructions. ChangeLog entries are as follows : *** gas/ChangeLog *** 2019-04-15 Sudakshina Das <[email protected]> * config/tc-arm.c (T16_32_TAB): New entries for bfx and bflx. (do_t_v8_1_branch): New switch cases for bfx and bflx. (insns): New instruction for bfx and bflx. * testsuite/gas/arm/armv8_1-m-bf-exchange.d: New. * testsuite/gas/arm/armv8_1-m-bf-exchange.s: New. * testsuite/gas/arm/armv8_1-m-bf-exchange-bad.s: New * testsuite/gas/arm/armv8_1-m-bf-exchange-bad.l: New * testsuite/gas/arm/armv8_1-m-bf-exchange-bad.d: New *** opcodes/ChangeLog *** 2019-04-15 Sudakshina Das <[email protected]> * arm-dis.c (print_insn_thumb32): Add '%<bitfield>S' to print an Arm register with r13 and r15 unpredictable. (thumb32_opcodes): New instructions for bfx and bflx.
1 parent 4389b29 commit f1c7f42

File tree

9 files changed

+84
-0
lines changed

9 files changed

+84
-0
lines changed

gas/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2019-04-15 Sudakshina Das <[email protected]>
2+
3+
* config/tc-arm.c (T16_32_TAB): New entries for bfx and bflx.
4+
(do_t_v8_1_branch): New switch cases for bfx and bflx.
5+
(insns): New instruction for bfx and bflx.
6+
* testsuite/gas/arm/armv8_1-m-bf-exchange.d: New.
7+
* testsuite/gas/arm/armv8_1-m-bf-exchange.s: New.
8+
* testsuite/gas/arm/armv8_1-m-bf-exchange-bad.s: New
9+
* testsuite/gas/arm/armv8_1-m-bf-exchange-bad.l: New
10+
* testsuite/gas/arm/armv8_1-m-bf-exchange-bad.d: New
11+
112
2019-04-15 Sudakshina Das <[email protected]>
213
Andre Vieira <[email protected]>
314

gas/config/tc-arm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10506,6 +10506,8 @@ encode_thumb32_addr_mode (int i, bfd_boolean is_t, bfd_boolean is_d)
1050610506
X(_b, e000, f000b000), \
1050710507
X(_bcond, d000, f0008000), \
1050810508
X(_bf, 0000, f040e001), \
10509+
X(_bfx, 0000, f060e001), \
10510+
X(_bflx, 0000, f070e001), \
1050910511
X(_bic, 4380, ea200000), \
1051010512
X(_bics, 4380, ea300000), \
1051110513
X(_cmn, 42c0, eb100f00), \
@@ -13362,6 +13364,11 @@ do_t_branch_future (void)
1336213364
}
1336313365
break;
1336413366

13367+
case T_MNEM_bfx:
13368+
case T_MNEM_bflx:
13369+
inst.instruction |= inst.operands[1].reg << 16;
13370+
break;
13371+
1336513372
default: abort ();
1336613373
}
1336713374
}
@@ -21679,6 +21686,8 @@ static const struct asm_opcode insns[] =
2167921686
#undef THUMB_VARIANT
2168021687
#define THUMB_VARIANT & arm_ext_v8_1m_main
2168121688
toC("bf", _bf, 2, (EXPs, EXPs), t_branch_future),
21689+
toC("bfx", _bfx, 2, (EXPs, RRnpcsp), t_branch_future),
21690+
toC("bflx", _bflx, 2, (EXPs, RRnpcsp), t_branch_future),
2168221691
};
2168321692
#undef ARM_VARIANT
2168421693
#undef THUMB_VARIANT
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#name: Invalid Armv8.1-M Mainline BF-exchange instructions
2+
#source: armv8_1-m-bf-exchange-bad.s
3+
#as: -march=armv8.1-m.main
4+
#error_output: armv8_1-m-bf-exchange-bad.l
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.*: Assembler messages:
2+
.*:6: Error: branch out of range or not a multiple of 2
3+
.*:7: Error: branch out of range or not a multiple of 2
4+
.*:8: Error: branch out of range or not a multiple of 2
5+
.*:9: Error: branch out of range or not a multiple of 2
6+
.*:11: Error: r15 not allowed here -- `bfx 2,PC'
7+
.*:12: Error: r13 not allowed here -- `bflx 2,SP'
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.syntax unified
2+
.text
3+
.thumb
4+
foo:
5+
# OP0 : Unsigned, 5-bit, even
6+
bfx 0, r3
7+
bfx -2, r3
8+
bflx 3, r3
9+
bflx 32, r3
10+
# OP1 : no SP or PC
11+
bfx 2, PC
12+
bflx 2, SP
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#name: Valid Armv8.1-M Mainline BF-exchange instructions
2+
#source: armv8_1-m-bf-exchange.s
3+
#as: -march=armv8.1-m.main
4+
#objdump: -dr --prefix-addresses --show-raw-insn
5+
6+
.*: +file format .*arm.*
7+
8+
Disassembly of section .text:
9+
0[0-9a-f]+ <[^>]+> f265 e001 bfx 8, r5
10+
0[0-9a-f]+ <[^>]+> 4609 mov r1, r1
11+
0[0-9a-f]+ <[^>]+> f173 e001 bflx 4, r3
12+
0[0-9a-f]+ <[^>]+> 460a mov r2, r1
13+
0[0-9a-f]+ <[^>]+> 4613 mov r3, r2
14+
0[0-9a-f]+ <[^>]+> 4614 mov r4, r2
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.syntax unified
2+
.text
3+
.thumb
4+
foo:
5+
bfx .LB1, r5
6+
mov r1, r1
7+
bflx .LB2, r3
8+
mov r2, r1
9+
.LB1:
10+
mov r3, r2
11+
.LB2:
12+
mov r4, r2

opcodes/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2019-04-15 Sudakshina Das <[email protected]>
2+
3+
* arm-dis.c (print_insn_thumb32): Add '%<bitfield>S' to print an
4+
Arm register with r13 and r15 unpredictable.
5+
(thumb32_opcodes): New instructions for bfx and bflx.
6+
17
2019-04-15 Sudakshina Das <[email protected]>
28

39
* arm-dis.c (thumb32_opcodes): New instructions for bf.

opcodes/arm-dis.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,6 +2730,7 @@ static const struct opcode16 thumb_opcodes[] =
27302730
%<bitfield>W print bitfield*4 in decimal
27312731
%<bitfield>r print bitfield as an ARM register
27322732
%<bitfield>R as %<>r but r15 is UNPREDICTABLE
2733+
%<bitfield>S as %<>r but r13 and r15 is UNPREDICTABLE
27332734
%<bitfield>c print bitfield as a condition code
27342735
27352736
%<bitfield>'c print specified char iff bitfield is all ones
@@ -2749,6 +2750,10 @@ static const struct opcode32 thumb32_opcodes[] =
27492750
/* Armv8.1-M Mainline instructions. */
27502751
{ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_1M_MAIN),
27512752
0xf040e001, 0xf860f001, "bf%c\t%G, %W"},
2753+
{ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_1M_MAIN),
2754+
0xf060e001, 0xf8f0f001, "bfx%c\t%G, %16-19S"},
2755+
{ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_1M_MAIN),
2756+
0xf070e001, 0xf8f0f001, "bflx%c\t%G, %16-19S"},
27522757

27532758

27542759
/* ARMv8-M and ARMv8-M Security Extensions instructions. */
@@ -6056,6 +6061,10 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given)
60566061
value_in_comment = val * 4;
60576062
break;
60586063

6064+
case 'S':
6065+
if (val == 13)
6066+
is_unpredictable = TRUE;
6067+
/* Fall through. */
60596068
case 'R':
60606069
if (val == 15)
60616070
is_unpredictable = TRUE;

0 commit comments

Comments
 (0)