1 .syntax unified 2 .bundle_align_mode 4 3 4# We use these macros to test each pattern at every offset from 5# bundle alignment, i.e. [0,16) by 2 or 4. 6 7.macro offset_insn insn_name, offset, size 8 .p2align 4 9\insn_name\()_offset_\offset\(): 10 .rept \offset / \size 11 bkpt 12 .endr 13 \insn_name 14.endm 15 16.macro test_offsets_arm insn_name 17 .arm 18 offset_insn \insn_name, 0, 4 19 offset_insn \insn_name, 4, 4 20 offset_insn \insn_name, 8, 4 21 offset_insn \insn_name, 12, 4 22.endm 23 24.macro test_offsets_thumb insn_name 25 .thumb 26 offset_insn \insn_name, 0, 2 27 offset_insn \insn_name, 2, 2 28 offset_insn \insn_name, 4, 2 29 offset_insn \insn_name, 6, 2 30 offset_insn \insn_name, 8, 2 31 offset_insn \insn_name, 10, 2 32 offset_insn \insn_name, 12, 2 33 offset_insn \insn_name, 14, 2 34.endm 35 36.macro test_arm 37 add r0, r1 38.endm 39 40.macro test_thumb_2 41 adds r0, r1 42.endm 43.macro test_thumb_4 44 adds r8, r9 45.endm 46 47test_offsets_arm test_arm 48test_offsets_thumb test_thumb_2 49test_offsets_thumb test_thumb_4 50 51# There are many relaxation cases for Thumb instructions. 52# But we use as representative the simple branch cases. 53 54.macro test_thumb_b_2 55 b 0f 56 bkpt 1 570: bkpt 2 58.endm 59.macro test_thumb_b_4 60 b far_target 61.endm 62 63test_offsets_thumb test_thumb_b_2 64test_offsets_thumb test_thumb_b_4 65 66# This is to set up a branch target surely too far for a short branch. 67pad_for_far_target: 68 .rept 1025 69 bkpt 1 70 .endr 71far_target: 72 bkpt 2 73.p2align 4 74 bkpt 75