1# Copyright (C) 1996-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# Please email any bugs, comments, and/or additions to this file to: 18# dejagnu@gnu.org 19 20# Written by Cygnus Support. 21 22proc do_arith {} { 23 set testname "arith.s: Arithmetic operations" 24 set x 0 25 26 gas_start "arith.s" "-al" 27 28 # Instead of having a variable for each match string just increment the 29 # total number of matches seen. That's simpler when testing large numbers 30 # of instructions (as these tests to). 31 # -re "^ +\[0-9\]+ 0000 489A0000\[^\n\]*\n" { set x [expr $x+1] } 32 while 1 { 33 expect { 34 -re "^ +\[0-9\]+ 0000 C531\[^\n\]*\n" { set x [expr $x+1] } 35 -re "^ +\[0-9\]+ 0002 4532\[^\n\]*\n" { set x [expr $x+1] } 36 -re "^ +\[0-9\]+ 0004 05360700\[^\n\]*\n" { set x [expr $x+1] } 37 -re "^ +\[0-9\]+ 0008 4530\[^\n\]*\n" { set x [expr $x+1] } 38 -re "^ +\[0-9\]+ 000a E530\[^\n\]*\n" { set x [expr $x+1] } 39 -re "^ +\[0-9\]+ 000c E532\[^\n\]*\n" { set x [expr $x+1] } 40 -re "^ +\[0-9\]+ 000e E5360700\[^\n\]*\n" { set x [expr $x+1] } 41 -re "^ +\[0-9\]+ 0012 E537A000\[^\n\]*\n" { set x [expr $x+1] } 42 -re "^ +\[0-9\]+ 0016 BF32\[^\n\]*\n" { set x [expr $x+1] } 43 -re "^ +\[0-9\]+ 0018 C530\[^\n\]*\n" { set x [expr $x+1] } 44 -re "^ +\[0-9\]+ 001a 2532\[^\n\]*\n" { set x [expr $x+1] } 45 -re "^ +\[0-9\]+ 001c A530\[^\n\]*\n" { set x [expr $x+1] } 46 -re "^ +\[0-9\]+ 001e 65360700\[^\n\]*\n" { set x [expr $x+1] } 47 -re "^ +\[0-9\]+ 0022 8530\[^\n\]*\n" { set x [expr $x+1] } 48 -re "^ +\[0-9\]+ 0024 E537C000\[^\n\]*\n" { set x [expr $x+1] } 49 -re "^ +\[0-9\]+ 0028 DF32\[^\n\]*\n" { set x [expr $x+1] } 50 -re "^ +\[0-9\]+ 002a E5378000\[^\n\]*\n" { set x [expr $x+1] } 51 -re "^ +\[0-9\]+ 002e 9F32\[^\n\]*\n" { set x [expr $x+1] } 52 -re "^ +\[0-9\]+ 0030 A531\[^\n\]*\n" { set x [expr $x+1] } 53 -re "^ +\[0-9\]+ 0032 8531\[^\n\]*\n" { set x [expr $x+1] } 54 -re "\[^\n\]*\n" { } 55 timeout { perror "timeout\n"; break } 56 eof { break } 57 } 58 } 59 60 # This was intended to do any cleanup necessary. It kinda looks like it 61 # isn't needed, but just in case, please keep it in for now. 62 gas_finish 63 64 # Did we find what we were looking for? If not, flunk it. 65 if [expr $x==20] then { pass $testname } else { fail $testname } 66} 67 68proc do_bit {} { 69 set testname "bit.s: bit operations" 70 set x 0 71 72 gas_start "bit.s" "-al" 73 74 # Instead of having a variable for each match string just increment the 75 # total number of matches seen. That's simpler when testing large numbers 76 # of instructions (as these tests to). 77 while 1 { 78 expect { 79 -re "^ +\[0-9\]+ 0000 C6AF1000\[^\n\]*\n" { set x [expr $x+1] } 80 -re "^ +\[0-9\]+ 0004 C66F1000\[^\n\]*\n" { set x [expr $x+1] } 81 -re "^ +\[0-9\]+ 0008 C62F1000\[^\n\]*\n" { set x [expr $x+1] } 82 -re "^ +\[0-9\]+ 000c C6EF1000\[^\n\]*\n" { set x [expr $x+1] } 83 -re "\[^\n\]*\n" { } 84 timeout { perror "timeout\n"; break } 85 eof { break } 86 } 87 } 88 89 # This was intended to do any cleanup necessary. It kinda looks like it 90 # isn't needed, but just in case, please keep it in for now. 91 gas_finish 92 93 # Did we find what we were looking for? If not, flunk it. 94 if [expr $x==4] then { pass $testname } else { fail $testname } 95} 96 97proc do_branch {} { 98 set testname "branch.s: branch operations" 99 set x 0 100 101 gas_start "branch.s" "-al" 102 103 # Instead of having a variable for each match string just increment the 104 # total number of matches seen. That's simpler when testing large numbers 105 # of instructions (as these tests to). 106 while 1 { 107 expect { 108 -re "^ +\[0-9\]+ 0000 8F05\[^\n\]*\n" { set x [expr $x+1] } 109 -re "^ +\[0-9\]+ 0002 FEFD\[^\n\]*\n" { set x [expr $x+1] } 110 -re "^ +\[0-9\]+ 0004 E6FD\[^\n\]*\n" { set x [expr $x+1] } 111 -re "^ +\[0-9\]+ 0006 D7FD\[^\n\]*\n" { set x [expr $x+1] } 112 -re "^ +\[0-9\]+ 0008 CBFD\[^\n\]*\n" { set x [expr $x+1] } 113 -re "^ +\[0-9\]+ 000a B9FD\[^\n\]*\n" { set x [expr $x+1] } 114 -re "^ +\[0-9\]+ 000c A1FD\[^\n\]*\n" { set x [expr $x+1] } 115 -re "^ +\[0-9\]+ 000e 93FD\[^\n\]*\n" { set x [expr $x+1] } 116 -re "^ +\[0-9\]+ 0010 82FD\[^\n\]*\n" { set x [expr $x+1] } 117 -re "^ +\[0-9\]+ 0012 FAF5\[^\n\]*\n" { set x [expr $x+1] } 118 -re "^ +\[0-9\]+ 0014 E0F5\[^\n\]*\n" { set x [expr $x+1] } 119 -re "^ +\[0-9\]+ 0016 D8F5\[^\n\]*\n" { set x [expr $x+1] } 120 -re "^ +\[0-9\]+ 0018 C4F5\[^\n\]*\n" { set x [expr $x+1] } 121 -re "^ +\[0-9\]+ 001a BCF5\[^\n\]*\n" { set x [expr $x+1] } 122 -re "^ +\[0-9\]+ 001c A1F5\[^\n\]*\n" { set x [expr $x+1] } 123 -re "^ +\[0-9\]+ 001e 99F5\[^\n\]*\n" { set x [expr $x+1] } 124 -re "^ +\[0-9\]+ 0020 82F5\[^\n\]*\n" { set x [expr $x+1] } 125 -re "^ +\[0-9\]+ 0022 FAED\[^\n\]*\n" { set x [expr $x+1] } 126 -re "^ +\[0-9\]+ 0024 E5ED\[^\n\]*\n" { set x [expr $x+1] } 127 -re "^ +\[0-9\]+ 0026 DDED\[^\n\]*\n" { set x [expr $x+1] } 128 -re "\[^\n\]*\n" { } 129 timeout { perror "timeout\n"; break } 130 eof { break } 131 } 132 } 133 134 # This was intended to do any cleanup necessary. It kinda looks like it 135 # isn't needed, but just in case, please keep it in for now. 136 gas_finish 137 138 # Did we find what we were looking for? If not, flunk it. 139 if [expr $x==20] then { pass $testname } else { fail $testname } 140} 141 142proc do_compare {} { 143 set testname "compare.s: compare operations" 144 set x 0 145 146 gas_start "compare.s" "-al" 147 148 # Instead of having a variable for each match string just increment the 149 # total number of matches seen. That's simpler when testing large numbers 150 # of instructions (as these tests to). 151 while 1 { 152 expect { 153 -re "^ +\[0-9\]+ 0000 E531\[^\n\]*\n" { set x [expr $x+1] } 154 -re "^ +\[0-9\]+ 0002 6532\[^\n\]*\n" { set x [expr $x+1] } 155 -re "^ +\[0-9\]+ 0004 E02F0000\[^\n\]*\n" { set x [expr $x+1] } 156 -re "^ +\[0-9\]+ 0008 E82F0000\[^\n\]*\n" { set x [expr $x+1] } 157 -re "^ +\[0-9\]+ 000c E12F0000\[^\n\]*\n" { set x [expr $x+1] } 158 -re "^ +\[0-9\]+ 0010 E12F0000\[^\n\]*\n" { set x [expr $x+1] } 159 -re "^ +\[0-9\]+ 0014 E92F0000\[^\n\]*\n" { set x [expr $x+1] } 160 -re "^ +\[0-9\]+ 0018 E92F0000\[^\n\]*\n" { set x [expr $x+1] } 161 -re "^ +\[0-9\]+ 001c E22F0000\[^\n\]*\n" { set x [expr $x+1] } 162 -re "^ +\[0-9\]+ 0020 EA2F0000\[^\n\]*\n" { set x [expr $x+1] } 163 -re "^ +\[0-9\]+ 0024 E32F0000\[^\n\]*\n" { set x [expr $x+1] } 164 -re "^ +\[0-9\]+ 0028 EB2F0000\[^\n\]*\n" { set x [expr $x+1] } 165 -re "^ +\[0-9\]+ 002c E42F0000\[^\n\]*\n" { set x [expr $x+1] } 166 -re "^ +\[0-9\]+ 0030 E42F0000\[^\n\]*\n" { set x [expr $x+1] } 167 -re "^ +\[0-9\]+ 0034 EC2F0000\[^\n\]*\n" { set x [expr $x+1] } 168 -re "^ +\[0-9\]+ 0038 EC2F0000\[^\n\]*\n" { set x [expr $x+1] } 169 -re "^ +\[0-9\]+ 003c E52F0000\[^\n\]*\n" { set x [expr $x+1] } 170 -re "^ +\[0-9\]+ 0040 ED2F0000\[^\n\]*\n" { set x [expr $x+1] } 171 -re "^ +\[0-9\]+ 0044 E62F0000\[^\n\]*\n" { set x [expr $x+1] } 172 -re "^ +\[0-9\]+ 0048 EE2F0000\[^\n\]*\n" { set x [expr $x+1] } 173 -re "^ +\[0-9\]+ 004c E72F0000\[^\n\]*\n" { set x [expr $x+1] } 174 -re "^ +\[0-9\]+ 0050 EF2F0000\[^\n\]*\n" { set x [expr $x+1] } 175 -re "^ +\[0-9\]+ 0054 6531\[^\n\]*\n" { set x [expr $x+1] } 176 -re "\[^\n\]*\n" { } 177 timeout { perror "timeout\n"; break } 178 eof { break } 179 } 180 } 181 182 # This was intended to do any cleanup necessary. It kinda looks like it 183 # isn't needed, but just in case, please keep it in for now. 184 gas_finish 185 186 # Did we find what we were looking for? If not, flunk it. 187 if [expr $x==23] then { pass $testname } else { fail $testname } 188} 189 190proc do_jumps {} { 191 set testname "jumps.s: jumps operations" 192 set x 0 193 194 gas_start "jumps.s" "-al" 195 196 # Instead of having a variable for each match string just increment the 197 # total number of matches seen. That's simpler when testing large numbers 198 # of instructions (as these tests to). 199 while 1 { 200 expect { 201 -re "^ +\[0-9\]+ 0000 802F0000\[^\n\]*\n" { set x [expr $x+1] } 202 -re "^ +\[0-9\]+ 0004 6500\[^\n\]*\n" { set x [expr $x+1] } 203 -re "^ +\[0-9\]+ 0006 BF07FAFF\[^\n\]*\n" { set x [expr $x+1] } 204 -re "\[^\n\]*\n" { } 205 timeout { perror "timeout\n"; break } 206 eof { break } 207 } 208 } 209 210 # This was intended to do any cleanup necessary. It kinda looks like it 211 # isn't needed, but just in case, please keep it in for now. 212 gas_finish 213 214 # Did we find what we were looking for? If not, flunk it. 215 if [expr $x==3] then { pass $testname } else { fail $testname } 216} 217 218proc do_logical {} { 219 set testname "logical.s: logical operations" 220 set x 0 221 222 gas_start "logical.s" "-al" 223 224 # Instead of having a variable for each match string just increment the 225 # total number of matches seen. That's simpler when testing large numbers 226 # of instructions (as these tests to). 227 while 1 { 228 expect { 229 -re "^ +\[0-9\]+ 0000 4531\[^\n\]*\n" { set x [expr $x+1] } 230 -re "^ +\[0-9\]+ 0002 C5360700\[^\n\]*\n" { set x [expr $x+1] } 231 -re "^ +\[0-9\]+ 0006 2530\[^\n\]*\n" { set x [expr $x+1] } 232 -re "^ +\[0-9\]+ 0008 0531\[^\n\]*\n" { set x [expr $x+1] } 233 -re "^ +\[0-9\]+ 000a 85360700\[^\n\]*\n" { set x [expr $x+1] } 234 -re "^ +\[0-9\]+ 000e 2531\[^\n\]*\n" { set x [expr $x+1] } 235 -re "^ +\[0-9\]+ 0010 A5360700\[^\n\]*\n" { set x [expr $x+1] } 236 -re "\[^\n\]*\n" { } 237 timeout { perror "timeout\n"; break } 238 eof { break } 239 } 240 } 241 242 # This was intended to do any cleanup necessary. It kinda looks like it 243 # isn't needed, but just in case, please keep it in for now. 244 gas_finish 245 246 # Did we find what we were looking for? If not, flunk it. 247 if [expr $x==7] then { pass $testname } else { fail $testname } 248} 249 250proc do_mem {} { 251 set testname "mem.s: memory operations" 252 set x 0 253 254 gas_start "mem.s" "-al" 255 256 # Instead of having a variable for each match string just increment the 257 # total number of matches seen. That's simpler when testing large numbers 258 # of instructions (as these tests to). 259 while 1 { 260 expect { 261 -re "^ +\[0-9\]+ 0000 05370500\[^\n\]*\n" { set x [expr $x+1] } 262 -re "^ +\[0-9\]+ 0004 25370400\[^\n\]*\n" { set x [expr $x+1] } 263 -re "^ +\[0-9\]+ 0008 25370500\[^\n\]*\n" { set x [expr $x+1] } 264 -re "^ +\[0-9\]+ 000c 4033\[^\n\]*\n" { set x [expr $x+1] } 265 -re "^ +\[0-9\]+ 000e 4034\[^\n\]*\n" { set x [expr $x+1] } 266 -re "^ +\[0-9\]+ 0010 4035\[^\n\]*\n" { set x [expr $x+1] } 267 -re "^ +\[0-9\]+ 0012 462F0500\[^\n\]*\n" { set x [expr $x+1] } 268 -re "^ +\[0-9\]+ 0016 662F0400\[^\n\]*\n" { set x [expr $x+1] } 269 -re "^ +\[0-9\]+ 001a 662F0500\[^\n\]*\n" { set x [expr $x+1] } 270 -re "^ +\[0-9\]+ 001e C033\[^\n\]*\n" { set x [expr $x+1] } 271 -re "^ +\[0-9\]+ 0020 C034\[^\n\]*\n" { set x [expr $x+1] } 272 -re "^ +\[0-9\]+ 0022 4135\[^\n\]*\n" { set x [expr $x+1] } 273 -re "\[^\n\]*\n" { } 274 timeout { perror "timeout\n"; break } 275 eof { break } 276 } 277 } 278 279 # This was intended to do any cleanup necessary. It kinda looks like it 280 # isn't needed, but just in case, please keep it in for now. 281 gas_finish 282 283 # Did we find what we were looking for? If not, flunk it. 284 if [expr $x==12] then { pass $testname } else { fail $testname } 285} 286 287proc do_misc {} { 288 set testname "misc.s: misc operations" 289 set x 0 290 291 gas_start "misc.s" "-al" 292 293 # Instead of having a variable for each match string just increment the 294 # total number of matches seen. That's simpler when testing large numbers 295 # of instructions (as these tests to). 296 while 1 { 297 expect { 298 -re "^ +\[0-9\]+ 0000 E0076001\[^\n\]*\n" { set x [expr $x+1] } 299 -re "^ +\[0-9\]+ 0004 E0876001\[^\n\]*\n" { set x [expr $x+1] } 300 -re "^ +\[0-9\]+ 0008 E0072001\[^\n\]*\n" { set x [expr $x+1] } 301 -re "^ +\[0-9\]+ 000c 0000\[^\n\]*\n" { set x [expr $x+1] } 302 -re "^ +\[0-9\]+ 000e E0074001\[^\n\]*\n" { set x [expr $x+1] } 303 -re "^ +\[0-9\]+ 0012 E0070001\[^\n\]*\n" { set x [expr $x+1] } 304 -re "^ +\[0-9\]+ 0016 FF070001\[^\n\]*\n" { set x [expr $x+1] } 305 -re "^ +\[0-9\]+ 001a E72F2000\[^\n\]*\n" { set x [expr $x+1] } 306 -re "^ +\[0-9\]+ 001e E53F4000\[^\n\]*\n" { set x [expr $x+1] } 307 -re "\[^\n\]*\n" { } 308 timeout { perror "timeout\n"; break } 309 eof { break } 310 } 311 } 312 313 # This was intended to do any cleanup necessary. It kinda looks like it 314 # isn't needed, but just in case, please keep it in for now. 315 gas_finish 316 317 # Did we find what we were looking for? If not, flunk it. 318 if [expr $x==9] then { pass $testname } else { fail $testname } 319} 320 321proc do_move {} { 322 set testname "move.s: move operations" 323 set x 0 324 325 gas_start "move.s" "-al" 326 327 # Instead of having a variable for each match string just increment the 328 # total number of matches seen. That's simpler when testing large numbers 329 # of instructions (as these tests to). 330 while 1 { 331 expect { 332 -re "^ +\[0-9\]+ 0000 0530\[^\n\]*\n" { set x [expr $x+1] } 333 -re "^ +\[0-9\]+ 0002 0532\[^\n\]*\n" { set x [expr $x+1] } 334 -re "^ +\[0-9\]+ 0004 25360700\[^\n\]*\n" { set x [expr $x+1] } 335 -re "^ +\[0-9\]+ 0008 45360700\[^\n\]*\n" { set x [expr $x+1] } 336 -re "\[^\n\]*\n" { } 337 timeout { perror "timeout\n"; break } 338 eof { break } 339 } 340 } 341 342 # This was intended to do any cleanup necessary. It kinda looks like it 343 # isn't needed, but just in case, please keep it in for now. 344 gas_finish 345 346 # Did we find what we were looking for? If not, flunk it. 347 if [expr $x==4] then { pass $testname } else { fail $testname } 348} 349 350proc do_hilo {} { 351 set testname "hilo.s: hilo tests" 352 set x 0 353 354 gas_start "hilo.s" "-al" 355 356 # Instead of having a variable for each match string just increment the 357 # total number of matches seen. That's simpler when testing large numbers 358 # of instructions (as these tests to). 359 while 1 { 360 expect { 361 -re "^ +\[0-9\]+ 0000 200EEFBE\[^\n\]*\n" { set x [expr $x+1] } 362 -re "^ +\[0-9\]+ 0004 410EAEDE\[^\n\]*\n" { set x [expr $x+1] } 363 -re "^ +\[0-9\]+ 0008 410EADDE\[^\n\]*\n" { set x [expr $x+1] } 364 -re "\[^\n\]*\n" { } 365 timeout { perror "timeout\n"; break } 366 eof { break } 367 } 368 } 369 370 # This was intended to do any cleanup necessary. It kinda looks like it 371 # isn't needed, but just in case, please keep it in for now. 372 gas_finish 373 374 # Did we find what we were looking for? If not, flunk it. 375 if [expr $x==3] then { pass $testname } else { fail $testname } 376} 377 378 379proc do_simple_reloc_tests {} { 380 set testname "reloc.s: Test for proper relocations (part 2)" 381 set x 0 382 383 if [gas_test_old "reloc.s" "-mgcc-abi" "Test for proper relocation (part 1)"] then { 384 objdump_start_no_subdir "a.out" "-r" 385 386 while 1 { 387 expect { 388 -re "^00000002\[^\n\]*R_V8\[A-Z0-9_\]+\[^\n\]*\n" 389 { set x [expr $x+1] } 390 -re "^00000006\[^\n\]*R_V8\[A-Z0-9_\]+\[^\n\]*\n" 391 { set x [expr $x+1] } 392 -re "^0000000a\[^\n\]*R_V8\[A-Z0-9_\]+\[^\n\]*\n" 393 { set x [expr $x+1] } 394 -re "^0000000e\[^\n\]*R_V8\[A-Z0-9_\]+\[^\n\]*\n" 395 { set x [expr $x+1] } 396 -re "^00000012\[^\n\]*R_V8\[A-Z0-9_\]+\[^\n\]*\n" 397 { set x [expr $x+1] } 398 -re "^00000016\[^\n\]*R_V8\[A-Z0-9_\]+\[^\n\]*\n" 399 { set x [expr $x+1] } 400 -re "\[^\n\]*\n" { } 401 timeout { perror "timeout\n"; break } 402 eof { break } 403 } 404 } 405 } 406 407 # This was intended to do any cleanup necessary. It kinda looks like it 408 # isn't needed, but just in case, please keep it in for now. 409 objdump_finish 410 411 # Did we find what we were looking for? If not, flunk it. 412 if [expr $x==6] then { pass $testname } else { fail $testname } 413} 414 415if [istarget v850*-*-*] then { 416 # Test the basic instruction parser. 417 do_arith 418 do_bit 419 do_branch 420 do_compare 421 do_jumps 422 do_logical 423 do_mem 424 do_misc 425 do_move 426 427 # Make sure we handle lo() hi() and hi0() correctly. 428 do_hilo 429 430 # Check for proper relocs on lo, hi, hi0, zdaoff, tdaoff and sdaoff 431 # expressions 432 do_simple_reloc_tests 433 434 gas_test "hilo2.s" "" "" "hi/lo regression test" 435 gas_test "fepsw.s" "" "" "eqsw regression test" 436 437 gas_test_error "range.s" "-mwarn-signed-overflow" "Check for range error on byte load/store" 438 run_dump_test "v850e1" 439 run_dump_test "split-lo16" 440} 441