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 # Several test cases are implemented in this file: |
| 6 # 1. Test if all load instructions are recognized as such. |
| 7 # 2. Test if load from sp is allowed. |
| 8 # 3. Test if mask and load instruction are split with delay slot. |
| 9 # 4. Test if mask and load instruction are in the same bundle. |
| 10 |
| 11 .globl _start |
| 12 _start: |
| 13 .align 4 |
| 14 .set noreorder |
| 15 .set STORE_MASK,$t7 |
| 16 |
| 17 # Check masked load. |
| 18 |
| 19 and $a0, $a0, STORE_MASK |
| 20 lw $v0, 16($a0) # OK |
| 21 nop |
| 22 nop |
| 23 |
| 24 # Test if all load instructions are recognized as such. |
| 25 |
| 26 bundle_load_instrs: |
| 27 lb $a0, 4($a1) # Error, unsafe load, no mask. |
| 28 lw $a0, 4($a1) # Error, unsafe load, no mask. |
| 29 lbu $a0, 4($a1) # Error, unsafe load, no mask. |
| 30 ldc1 $f0, 4($a1) # Error, unsafe load, no mask. |
| 31 |
| 32 ldc2 $10, -24($a1) # Error, unsafe load, no mask. |
| 33 lh $a0, 4($a1) # Error, unsafe load, no mask. |
| 34 lhu $a0, 4($a1) # Error, unsafe load, no mask. |
| 35 ll $a0, 4($a1) # Error, unsafe load, no mask. |
| 36 |
| 37 lw $a0, 4($a1) # Error, unsafe load, no mask. |
| 38 lwc1 $f0, 4($a1) # Error, unsafe load, no mask. |
| 39 lwc2 $10, 4($a1) # Error, unsafe load, no mask. |
| 40 lwl $a0, 4($a1) # Error, unsafe load, no mask. |
| 41 |
| 42 lwr $a0, 4($a1) # Error, unsafe load, no mask. |
| 43 ldxc1 $f0, $0($a1) # Forbidden instruction, unsafe load. |
| 44 luxc1 $f0, $a2($a1) # Forbidden instruction, unsafe load. |
| 45 lwxc1 $f6, $v0($a1) # Forbidden instruction, unsafe load. |
| 46 |
| 47 # Test if load from sp is allowed. |
| 48 |
| 49 bundle_load_from_sp: |
| 50 lw $v0, 16($sp) # OK |
| 51 nop |
| 52 and $t2, $t2, STORE_MASK |
| 53 lw $t1, 16($t2) # OK |
| 54 |
| 55 # Test when load pseudo-instruction is split with delay slot. |
| 56 |
| 57 bundle_chk_delay_slot: |
| 58 b bundle_chk_bundle_cross_1 |
| 59 and $s0, $s0, STORE_MASK # OK |
| 60 lw $a0, 16($s0) |
| 61 nop |
| 62 |
| 63 # Test when load pseudo-instruction crosses bundle. |
| 64 |
| 65 bundle_chk_bundle_cross_1: |
| 66 nop |
| 67 nop |
| 68 nop |
| 69 and $a3, $a3, STORE_MASK |
| 70 |
| 71 |
| 72 bundle_chk_bundle_cross_2: |
| 73 lw $a3, 16($a3) # Error, pattern crosses bundle. |
| 74 nop |
| 75 nop |
| 76 nop |
| 77 |
| 78 lbux $a3, $t2($t3) # Error, forbidden instruction. |
| 79 lhx $a1, $a2($a3) # Error, forbidden instruction. |
| 80 lwx $t1, $t2($t3) # Error, forbidden instruction. |
| 81 nop |
| 82 |
| 83 end_of_code: |
OLD | NEW |