forked from bminor/binutils-gdb
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from MediaTek-Labs/fix_imm48
Rewrite instructions with problematic imm48 encoding
- Loading branch information
Showing
9 changed files
with
260 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.linkrelax | ||
.section .text,"ax",@progbits | ||
.align 4 | ||
.globl __start | ||
.ent __start | ||
__start: | ||
# li[48] -> lapc[48]. | ||
li $a0, foo | ||
# li[48] -> aluipc + ori. | ||
li $a1, bar | ||
li $a2, frob | ||
# addiu[48] -> lapc[48] + addu | ||
addiu $a3, foo | ||
# addiu[48] -> aluipc + ori + addu | ||
addiu $a4, bar | ||
addiu $a5, frob | ||
# lapc[48] -> aluipc + ori. | ||
lapc.b $t0, foo | ||
lapc.b $t1, bar | ||
swpc $t2, foo | ||
swpc $t3, bar | ||
.end __start | ||
.size __start, .-__start | ||
|
||
.section .foo,"ax",@progbits | ||
.align 4 | ||
.globl foo | ||
.ent foo | ||
foo: | ||
jrc $ra | ||
.end foo | ||
.size foo, .-foo | ||
.section .bar,"ax",@progbits | ||
.align 4 | ||
.globl bar | ||
.ent bar | ||
bar: | ||
jrc $ra | ||
.end bar | ||
.size bar, .-bar | ||
.section .frob,"ax",@progbits | ||
.align 4 | ||
.globl frob | ||
.ent frob | ||
frob: | ||
jrc $ra | ||
.end frob | ||
.size frob, .-frob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/sh | ||
|
||
# nanomips_function_call.sh -- test nanoMIPS function call transformations. | ||
|
||
# Copyright (C) 2018 Free Software Foundation, Inc. | ||
# Written by Vladimir Radosavljevic <[email protected]>. | ||
|
||
# This file is part of gold. | ||
|
||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
|
||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
|
||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | ||
# MA 02110-1301, USA. | ||
|
||
check() | ||
{ | ||
file=$1 | ||
pattern=$2 | ||
|
||
found=`grep "$pattern" $file` | ||
if test -z "$found"; then | ||
echo "pattern \"$pattern\" not found in file $file." | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Test li[48] transformation into lapc[48]. | ||
check nanomips_fix_hw110880.stdout " 1000000: 6083 23fa lapc\[48\] a0.*" | ||
|
||
# Test li[48] transformation into aluipc, ori. | ||
check nanomips_fix_hw110880.stdout " 1000006: e0a1 2a22 aluipc a1,.*" | ||
check nanomips_fix_hw110880.stdout " 100000a: 80a5 0500 ori a1,a1,.*" | ||
|
||
# Test li[48] not being transformed | ||
check nanomips_fix_hw110880.stdout " 100000e: 60c0 0000 li\[48\] a2,.*" | ||
|
||
# Test addiu[48] transformation into lapc[48], addu. | ||
check nanomips_fix_hw110880.stdout " 1000014: 6023 23e6 lapc\[48\] at,.*" | ||
check nanomips_fix_hw110880.stdout " 100001a: 2027 3950 addu\[32\] a3,a3,at" | ||
|
||
# Test addiu[48] transformation into aluipc, ori, addu. | ||
check nanomips_fix_hw110880.stdout " 100001e: e021 2a22 aluipc at,.*" | ||
check nanomips_fix_hw110880.stdout " 1000022: 8021 0500 ori at,at,.*" | ||
check nanomips_fix_hw110880.stdout " 1000026: 2028 4150 addu\[32\] a4,a4,at" | ||
|
||
# Test addiu[48] not being transformed | ||
check nanomips_fix_hw110880.stdout " 100002a: 6121 0000 addiu\[48\] a5,a5,.*" | ||
|
||
# Test lapc[48] not being transformed | ||
check nanomips_fix_hw110880.stdout " 1000030: 6183 23ca lapc\[48\] t0,.*" | ||
|
||
# Test lapc[48] transformation into aluipc, ori. | ||
check nanomips_fix_hw110880.stdout " 1000036: e1a1 2a22 aluipc t1,.*" | ||
check nanomips_fix_hw110880.stdout " 100003a: 81ad 0500 ori t1,t1,.*" | ||
|
||
# Test swpc[48] not being transformed | ||
check nanomips_fix_hw110880.stdout " 100003e: 61cf 23bc swpc\[48\] t2,.*" | ||
|
||
# Test swpc[48] transformation into aluipc, sw. | ||
check nanomips_fix_hw110880.stdout " 1000044: e021 2a22 aluipc at,.*" | ||
check nanomips_fix_hw110880.stdout " 1000048: 85e1 9500 sw\[u12\] t3,.*(at)" | ||
|
||
exit 0 |