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 store instructions are recognized as such. |
| 7 # 2. Test if store from sp is allowed. |
| 8 # 3. Test if mask and instruction are split with delay slot. |
| 9 # 4. Test if mask and 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 store with mask. |
| 18 |
| 19 bundle_store_mask: |
| 20 and $a3, $a3, STORE_MASK |
| 21 sw $s1, 128($a3) # OK |
| 22 and $a3, $a3, $t8 |
| 23 sw $s1, 128($a3) # Error, incorrect mask. |
| 24 |
| 25 # Store instructions without store mask, should report error. |
| 26 |
| 27 bundle_store_list: |
| 28 sb $a0, 16($a1) # Error, unsafe store, no mask. |
| 29 sc $a0, 16($a1) # Error, unsafe store, no mask. |
| 30 sdc1 $0, 16($a1) # Error, unsafe store, no mask. |
| 31 sdc2 $8, 16($a1) # Error, unsafe store, no mask. |
| 32 |
| 33 sh $a0, 16($a1) # Error, unsafe store, no mask. |
| 34 sw $a0, 16($a1) # Error, unsafe store, no mask. |
| 35 swc1 $f2, 16($a1) # Error, unsafe store, no mask. |
| 36 swc2 $22, 16($a1) # Error, unsafe store, no mask. |
| 37 |
| 38 swl $a0, 16($a1) # Error, unsafe store, no mask. |
| 39 swr $a0, 16($a1) # Error, unsafe store, no mask. |
| 40 nop |
| 41 nop |
| 42 |
| 43 # A few forbidden instructions (indexed store). |
| 44 |
| 45 bundle_indexed_store: |
| 46 sdxc1 $f6, $a2($a0) # Error, forbidden instruction. |
| 47 suxc1 $f4, $t8($a1) # Error, forbidden instruction. |
| 48 swxc1 $f4, $t8($a1) # Error, forbidden instruction. |
| 49 nop |
| 50 |
| 51 bundle_store_from_sp: |
| 52 sw $a0, 16($sp) # OK - store from sp doesn't need a mask. |
| 53 nop |
| 54 nop |
| 55 nop |
| 56 |
| 57 # Test when store pseudo-instruction is split with delay slot. |
| 58 |
| 59 bundle_chk_delay_slot: |
| 60 b bundle_chk_bundle_cross_1 |
| 61 and $s0, $s0, STORE_MASK |
| 62 sw $v0, 16($s0) # OK |
| 63 nop |
| 64 |
| 65 # Test when store pseudo-instruction crosses bundle. |
| 66 |
| 67 bundle_chk_bundle_cross_1: |
| 68 nop |
| 69 nop |
| 70 nop |
| 71 and $a3, $a3, STORE_MASK |
| 72 |
| 73 bundle_chk_bundle_cross_2: |
| 74 sw $a3, 16($a3) # Error, pseudo-instruction crosses bundle. |
| 75 nop |
| 76 nop |
| 77 nop |
| 78 |
| 79 # Test indexed store with store mask. |
| 80 |
| 81 bundle_indexed_store_index_not_zero: |
| 82 and $a0, $a0, STORE_MASK |
| 83 sdxc1 $f6, $a2($a0) # Error, forbidden instruction. |
| 84 nop |
| 85 nop |
| 86 |
| 87 # Test if base register is properly recognized. |
| 88 |
| 89 bundle_sp_1: |
| 90 sw $sp,0($t1) # Error, no store mask for t1. |
| 91 and $sp,$sp,STORE_MASK |
| 92 nop |
| 93 nop |
| 94 |
| 95 end_of_code: |
OLD | NEW |