summaryrefslogtreecommitdiff
path: root/build/make/thumb.pm
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2013-05-15 17:09:22 +0300
committerMartin Storsjo <martin@martin.st>2013-05-22 01:50:57 +0300
commit6b9a7b3333352a6f0e8f1b2d8b690b33e18a9a08 (patch)
treeba6d68ca7bdb67e5191a92c2e35fe5bddb06cad9 /build/make/thumb.pm
parentf5d3be7e96e7852144120e62168dae8bca081fa2 (diff)
downloadlibvpx-6b9a7b3333352a6f0e8f1b2d8b690b33e18a9a08.tar
libvpx-6b9a7b3333352a6f0e8f1b2d8b690b33e18a9a08.tar.gz
libvpx-6b9a7b3333352a6f0e8f1b2d8b690b33e18a9a08.tar.bz2
libvpx-6b9a7b3333352a6f0e8f1b2d8b690b33e18a9a08.zip
thumb: Add a parameter for specifying a shift offset for the pc addition conversion
The branch instructions are encoded as 16 bit instructions by the microsoft assembler, while they are encoded as 32 bit instructions by gnu binutils. Change-Id: I622b9025df3520c08eef8447df078f5517fb4b67
Diffstat (limited to 'build/make/thumb.pm')
-rw-r--r--build/make/thumb.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/build/make/thumb.pm b/build/make/thumb.pm
index d04dffe85..f34728743 100644
--- a/build/make/thumb.pm
+++ b/build/make/thumb.pm
@@ -11,8 +11,11 @@
package thumb;
-sub FixThumbInstructions($)
+sub FixThumbInstructions($$)
{
+ my $short_branches = $_[1];
+ my $branch_shift_offset = $short_branches ? 1 : 0;
+
# Write additions with shifts, such as "add r10, r11, lsl #8",
# in three operand form, "add r10, r10, r11, lsl #8".
s/(add\s+)(r\d+),\s*(r\d+),\s*(lsl #\d+)/$1$2, $2, $3, $4/g;
@@ -56,7 +59,7 @@ sub FixThumbInstructions($)
# "itttt lt", "movlt.n r12, pc", "addlt.w r12, #12",
# "addlt.w r12, r12, r3, lsl #2", "movlt.n pc, r12".
# This assumes that r12 is free at this point.
- s/^(\s*)addlt(\s+)pc,\s*pc,\s*(\w+),\s*lsl\s*#(\d+)/$1itttt$2lt\n$1movlt.n$2r12, pc\n$1addlt.w$2r12, #12\n$1addlt.w$2r12, r12, $3, lsl #$4\n$1movlt.n$2pc, r12/g;
+ s/^(\s*)addlt(\s+)pc,\s*pc,\s*(\w+),\s*lsl\s*#(\d+)/$1itttt$2lt\n$1movlt.n$2r12, pc\n$1addlt.w$2r12, #12\n$1addlt.w$2r12, r12, $3, lsl #($4-$branch_shift_offset)\n$1movlt.n$2pc, r12/g;
# Convert "mov pc, lr" into "bx lr", since the former only works
# for switching from arm to thumb (and only in armv7), but not