OLD | NEW |
(Empty) | |
| 1 # Copyright 2012 The Native Client Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can |
| 3 # be found in the LICENSE file. |
| 4 |
| 5 # |
| 6 # Test jump register instructions (jr and jalr). |
| 7 # |
| 8 |
| 9 .globl _start |
| 10 _start: |
| 11 .align 4 |
| 12 .set noreorder |
| 13 .set JUMP_MASK,$t6 |
| 14 .set STORE_MASK,$t7 |
| 15 |
| 16 bundle_8mod16_jr: |
| 17 nop |
| 18 and $t1,$t1,JUMP_MASK |
| 19 jr $t1 # OK |
| 20 nop # Instruction in the delay slot is indented. |
| 21 |
| 22 bundle_4mod16_jr: |
| 23 and $t1,$t1,JUMP_MASK |
| 24 jr $t1 # OK |
| 25 nop |
| 26 nop |
| 27 |
| 28 bundle_8mod16_jalr: |
| 29 nop |
| 30 and $t1,$t1,JUMP_MASK |
| 31 jalr $t1 # OK |
| 32 nop |
| 33 |
| 34 # Jalr instruction not at bundle offset 8. |
| 35 |
| 36 bundle_4mod16_jalr: |
| 37 and $t1,$t1,JUMP_MASK |
| 38 jalr $t1 # Error, misaligned call. |
| 39 nop |
| 40 and $a1,$a1,JUMP_MASK |
| 41 |
| 42 cross_bundle: |
| 43 jr $a1 # Error, pseudo-instruction crosses bundle. |
| 44 nop |
| 45 nop |
| 46 nop |
| 47 |
| 48 bundle_bad_mask: |
| 49 addiu $a0, $zero, 16 |
| 50 and $a1, $a1, STORE_MASK |
| 51 jalr $a1 # Error, bad jump mask. |
| 52 nop |
| 53 |
| 54 bundle_no_mask: |
| 55 addiu $a0, $zero, 16 |
| 56 lw $a2, 16($sp) |
| 57 jalr $a1 # Error, no jump mask. |
| 58 nop |
| 59 |
| 60 bundle_jalr_t0_t9: |
| 61 addu $s0, $a0, $a1 |
| 62 and $v0, $v0, JUMP_MASK |
| 63 jalr $t0, $v0 # ok |
| 64 nop |
| 65 |
| 66 bundle_jalr_t7_t9: |
| 67 addu $s0, $a0, $a1 |
| 68 and $v0, $v0, JUMP_MASK |
| 69 jalr STORE_MASK, $v0 # Error, alteration of read only register. |
| 70 nop |
| 71 |
| 72 bundle_jalr_t7_t92: |
| 73 addu $s0, $a0, $a1 |
| 74 and $v0, $v0, JUMP_MASK |
| 75 jalr $sp, $v0 # Error, alteration of sp register. |
| 76 nop |
| 77 |
| 78 bundle_jal_delay_slot: |
| 79 b bundle_jalr_t7_t92 |
| 80 and $v0, $v0, JUMP_MASK |
| 81 jalr $t0, $v0 # OK |
| 82 nop |
| 83 |
| 84 end_of_code: |
OLD | NEW |