diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2017-04-10 13:12:52 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-04-10 13:12:52 +0100 |
commit | 947fa9141488c1d39303fcdaa056332d2d0b2599 (patch) | |
tree | a39cb09310958310a7bb3692a0156769e1d01472 /gas/testsuite | |
parent | bb1dd176fb6f38ae3cc30dc61ce55a7fbf9d0d7b (diff) | |
download | gdb-947fa9141488c1d39303fcdaa056332d2d0b2599.zip gdb-947fa9141488c1d39303fcdaa056332d2d0b2599.tar.gz gdb-947fa9141488c1d39303fcdaa056332d2d0b2599.tar.bz2 |
gas: xtensa: fix incorrect code generated with auto litpools
* config/tc-xtensa.c (xtensa_maybe_create_literal_pool_frag):
Initialize lps->frag_count with auto_litpool_limit.
(xg_promote_candidate_litpool): New function.
(xtensa_move_literals): Extract candidate litpool promotion code
into separate function. Call it for all possible found
candidates.
(xtensa_switch_to_literal_fragment): Drop 'recursive' flag and
call to xtensa_mark_literal_pool_location that it guards.
Replace it with call to xtensa_maybe_create_literal_pool_frag.
Initialize pool_location with created literal pool candidate.
* testsuite/gas/xtensa/all.exp: Add new tests.
* testsuite/gas/xtensa/auto-litpools-first1.d: New test results.
* testsuite/gas/xtensa/auto-litpools-first1.s: New test.
* testsuite/gas/xtensa/auto-litpools-first2.d: New test results.
* testsuite/gas/xtensa/auto-litpools-first2.s: New test.
* testsuite/gas/xtensa/auto-litpools.d: Fix offsets changed due
to additional jump instruction.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/xtensa/all.exp | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/xtensa/auto-litpools-first1.d | 12 | ||||
-rw-r--r-- | gas/testsuite/gas/xtensa/auto-litpools-first1.s | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/xtensa/auto-litpools-first2.d | 15 | ||||
-rw-r--r-- | gas/testsuite/gas/xtensa/auto-litpools-first2.s | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/xtensa/auto-litpools.d | 6 |
6 files changed, 38 insertions, 3 deletions
diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp index 98041b5..1ab3827 100644 --- a/gas/testsuite/gas/xtensa/all.exp +++ b/gas/testsuite/gas/xtensa/all.exp @@ -101,6 +101,8 @@ if [istarget xtensa*-*-*] then { run_dump_test "trampoline" run_dump_test "first_frag_align" run_dump_test "auto-litpools" + run_dump_test "auto-litpools-first1" + run_dump_test "auto-litpools-first2" run_dump_test "loc" run_dump_test "init-fini-literals" } diff --git a/gas/testsuite/gas/xtensa/auto-litpools-first1.d b/gas/testsuite/gas/xtensa/auto-litpools-first1.d new file mode 100644 index 0000000..322cdc5 --- /dev/null +++ b/gas/testsuite/gas/xtensa/auto-litpools-first1.d @@ -0,0 +1,12 @@ +#as: --auto-litpools +#objdump: -ds +#name: auto-litpools-first1 (check that literal pool is created when source starts with literal) + +.*: +file format .*xtensa.* +#... +Contents of section .text: + 0000 ........ 20170331 .* +#... +00000000 <f>: +.*0:.*j.8 .* +#... diff --git a/gas/testsuite/gas/xtensa/auto-litpools-first1.s b/gas/testsuite/gas/xtensa/auto-litpools-first1.s new file mode 100644 index 0000000..7ac0bf8 --- /dev/null +++ b/gas/testsuite/gas/xtensa/auto-litpools-first1.s @@ -0,0 +1,3 @@ +f: + .literal .L0, 0x20170331 + l32r a2, .L0 diff --git a/gas/testsuite/gas/xtensa/auto-litpools-first2.d b/gas/testsuite/gas/xtensa/auto-litpools-first2.d new file mode 100644 index 0000000..a6b798e --- /dev/null +++ b/gas/testsuite/gas/xtensa/auto-litpools-first2.d @@ -0,0 +1,15 @@ +#as: --auto-litpools +#objdump: -ds +#name: auto-litpools-first2 (check that literal pool with jump around is created for generated literal) + +.*: +file format .*xtensa.* +#... +Contents of section .text: + 0000 ........ ........ 20170331 .* +#... +00000000 <f>: + 0:.*addi.*a1.* + 3:.*j.*c.* +#... + c:.*l32r.*a2, 8.* +#... diff --git a/gas/testsuite/gas/xtensa/auto-litpools-first2.s b/gas/testsuite/gas/xtensa/auto-litpools-first2.s new file mode 100644 index 0000000..c097dac --- /dev/null +++ b/gas/testsuite/gas/xtensa/auto-litpools-first2.s @@ -0,0 +1,3 @@ +f: + addi a1, a1, -16 + movi a2, 0x20170331 diff --git a/gas/testsuite/gas/xtensa/auto-litpools.d b/gas/testsuite/gas/xtensa/auto-litpools.d index 4d1a690..fc6f5cb 100644 --- a/gas/testsuite/gas/xtensa/auto-litpools.d +++ b/gas/testsuite/gas/xtensa/auto-litpools.d @@ -4,9 +4,9 @@ .*: +file format .*xtensa.* #... -.*4:.*l32r.a2, 0 .* +.*8:.*l32r.a2, 4 .* #... -.*3e437:.*j.3e440 .* +.*3e43b:.*j.3e444 .* #... -.*40750:.*l32r.a2, 3e43c .* +.*40754:.*l32r.a2, 3e440 .* #... |