1# Copyright (C) 2012-2014 Free Software Foundation, Inc.
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
17#
18# Some generic xtensa tests
19#
20if [istarget xtensa*-*-*] then {
21    gas_test_error "j_too_far.s" "" "Check for jump out of range error"
22
23    set testname "j_too_far.s: error line number reporting"
24    gas_start "j_too_far.s" ""
25    set x1 0
26    while 1 {
27        expect {
28            -re ":4: Error:.*out of range"      { set x1 1 }
29            timeout                             { perror "timeout\n"; break }
30            eof                                 { break }
31        }
32    }
33    gas_finish
34    if [all_ones $x1] then { pass $testname } else { fail $testname }
35
36
37    gas_test "entry_misalign.s" "" "" "Xtensa Entry misalignment"
38    set testname "entry_misalign.s: Force entry misalignment"
39    objdump_start_no_subdir "a.out" "-d -j .text"
40    set x1 0
41    while 1 {
42	expect {
43	    -re "^.*2:.*entry" { set x1 1 }
44	    timeout            { perror "timeout\n"; break }
45	    eof                { break }
46	}
47    }
48    objdump_finish
49    if [all_ones $x1] then { pass $testname } else { fail $testname }
50
51
52    gas_test "entry_misalign2.s" "" "" "Xtensa Entry misalignment(2)"
53    set testname "entry_misalign2.s: Force entry misalignment(2)"
54    objdump_start_no_subdir "a.out" "-d -j .text"
55    set x1 0
56    while 1 {
57	expect {
58	    -re "^.*2:.*entry" { set x1 1 }
59	    timeout            { perror "timeout\n"; break }
60	    eof                { break }
61	}
62    }
63    objdump_finish
64    if [all_ones $x1] then { pass $testname } else { fail $testname }
65
66    gas_test_error "entry_align.s" "" "Xtensa entry alignment error"
67
68    gas_test "loop_misalign.s" "" "" "Xtensa Loop misalignment"
69    set testname "loop_misalign.s: Force loop misalignment"
70    objdump_start_no_subdir "a.out" "-d -j .text"
71    set x1 0
72    while 1 {
73	expect {
74	    -re "^.*0:.*loop" { set x1 1 }
75	    timeout            { perror "timeout\n"; break }
76	    eof                { break }
77	}
78    }
79    objdump_finish
80    if [all_ones $x1] then { pass $testname } else { fail $testname }
81
82
83    gas_test "loop_align.s" "" "" "Xtensa autoalign loop"
84    set testname "loop_align.s: autoalign loop"
85    objdump_start_no_subdir "a.out" "-d -j .text"
86    set x1 0
87    while 1 {
88	expect {
89	    -re "^.*2:.*loop" { set x1 1 }
90	    timeout            { perror "timeout\n"; break }
91	    eof                { break }
92	}
93    }
94    objdump_finish
95    if [all_ones $x1] then { pass $testname } else { fail $testname }
96
97    run_dump_test "short_branch_offset"
98    run_dump_test "pcrel"
99    run_dump_test "weak-call"
100    run_dump_test "jlong"
101    run_dump_test "trampoline"
102    run_dump_test "first_frag_align"
103}
104
105if [info exists errorInfo] then {
106    unset errorInfo
107}
108