| 1 | /* |
| 2 | * ========== Copyright Header Begin ========================================== |
| 3 | * |
| 4 | * OpenSPARC T2 Processor File: memop_all_loads.s |
| 5 | * Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved |
| 6 | * 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
| 7 | * |
| 8 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; version 2 of the License. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 | * |
| 23 | * For the avoidance of doubt, and except that if any non-GPL license |
| 24 | * choice is available it will apply instead, Sun elects to use only |
| 25 | * the General Public License version 2 (GPLv2) at this time for any |
| 26 | * software where a choice of GPL license versions is made |
| 27 | * available with the language indicating that GPLv2 or any later version |
| 28 | * may be used, or where a choice of which version of the GPL is applied is |
| 29 | * otherwise unspecified. |
| 30 | * |
| 31 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 32 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 33 | * have any questions. |
| 34 | * |
| 35 | * |
| 36 | * ========== Copyright Header End ============================================ |
| 37 | */ |
| 38 | #define MAIN_PAGE_NUCLEUS_ALSO |
| 39 | #define MAIN_PAGE_HV_ALSO |
| 40 | |
| 41 | #include "hboot.s" |
| 42 | #include "asi_s.h" |
| 43 | |
| 44 | /************************************************************************ |
| 45 | Test case code start |
| 46 | ************************************************************************/ |
| 47 | |
| 48 | .text |
| 49 | .global main |
| 50 | |
| 51 | main: |
| 52 | ta T_CHANGE_HPRIV |
| 53 | |
| 54 | ! Set up seperate temporary memory location for each thread, in %g3 |
| 55 | |
| 56 | setx temp, %g1, %g3 |
| 57 | ta T_RD_THID |
| 58 | sllx %o1, 6, %l1 |
| 59 | add %g3, %l1, %g3 |
| 60 | |
| 61 | ! |
| 62 | ! Thread 0 Start |
| 63 | ! |
| 64 | thread_0: |
| 65 | |
| 66 | ! Integer loads |
| 67 | |
| 68 | setx user_data_start, %g1, %g2 |
| 69 | ldsb: |
| 70 | ldsb [%g2 + 0x8], %l0 |
| 71 | cmp %l0, 0x11 |
| 72 | bne test_failed |
| 73 | nop |
| 74 | ldsh: |
| 75 | setx 0x2222, %g1, %g7 |
| 76 | ldsh [%g2 + 0x10], %l1 |
| 77 | cmp %l1, %g7 |
| 78 | bne test_failed |
| 79 | nop |
| 80 | ldsw: |
| 81 | setx 0x33333333, %g1, %g7 |
| 82 | ldsw [%g2 + 0x18], %l2 |
| 83 | cmp %l2, %g7 |
| 84 | bne test_failed |
| 85 | nop |
| 86 | ldub: |
| 87 | setx 0x44, %g1, %g7 |
| 88 | ldub [%g2 + 0x20], %l3 |
| 89 | cmp %l3, %g7 |
| 90 | bne test_failed |
| 91 | nop |
| 92 | lduh: |
| 93 | setx 0x5555, %g1, %g7 |
| 94 | lduh [%g2 + 0x28], %l4 |
| 95 | cmp %l4, %g7 |
| 96 | bne test_failed |
| 97 | nop |
| 98 | lduw: |
| 99 | setx 0x66666666, %g1, %g7 |
| 100 | lduw [%g2 + 0x30], %l5 |
| 101 | cmp %l5, %g7 |
| 102 | bne test_failed |
| 103 | nop |
| 104 | ldx: |
| 105 | setx 0x7777777777777777, %g1, %g7 |
| 106 | ldx [%g2 + 0x38], %l6 |
| 107 | cmp %l6, %g7 |
| 108 | bne test_failed |
| 109 | nop |
| 110 | ldd: |
| 111 | setx 0x88888888, %g1, %g7 |
| 112 | ldd [%g2 + 0x40], %l0 |
| 113 | cmp %l0, %g7 |
| 114 | bne test_failed |
| 115 | cmp %l1, %g7 |
| 116 | bne test_failed |
| 117 | nop |
| 118 | |
| 119 | ! Floating point loads |
| 120 | |
| 121 | setx floating_point_data, %g1, %g2 |
| 122 | ldf: |
| 123 | ld [%g2], %f0 |
| 124 | st %f0, [%g3] |
| 125 | ld [%g3], %l1 |
| 126 | setx 0x3f800000, %g1, %g4 |
| 127 | cmp %l1, %g4 |
| 128 | bne test_failed |
| 129 | nop |
| 130 | lddf: |
| 131 | ldd [%g2+0x8], %f2 |
| 132 | std %f2, [%g3] |
| 133 | setx 0x4000000000000000, %g1, %g5 |
| 134 | ldx [%g3], %l2 |
| 135 | cmp %l2, %g5 |
| 136 | bne test_failed |
| 137 | nop |
| 138 | ldfsr: |
| 139 | ld [%g2+0x10], %fsr |
| 140 | st %fsr, [%g3] |
| 141 | ld [%g3], %l3 |
| 142 | cmp %l3, 0 |
| 143 | bne test_failed |
| 144 | nop |
| 145 | ldxfsr: |
| 146 | ldx [%g2+0x10], %fsr |
| 147 | stx %fsr, [%g3] |
| 148 | ldx [%g3], %l3 |
| 149 | cmp %l3, 0 |
| 150 | bne test_failed |
| 151 | nop |
| 152 | |
| 153 | ! VIS loads |
| 154 | setx vis_data, %g1, %g2 |
| 155 | ldfa: |
| 156 | ldda [%g2]ASI_FL8_PRIMARY, %f6 |
| 157 | st %f7, [%g3] |
| 158 | ld [%g3], %l4 |
| 159 | ldub [%g2], %l5 |
| 160 | cmp %l4, %l5 |
| 161 | bne test_failed |
| 162 | nop |
| 163 | lddfa: |
| 164 | wr %g0, ASI_FL16_PRIMARY, %asi |
| 165 | ldda [%g2+0x4]%asi, %f2 |
| 166 | st %f3, [%g3] |
| 167 | ld [%g3], %l5 |
| 168 | lduh [%g2+0x4], %l6 |
| 169 | cmp %l5, %l6 |
| 170 | bne test_failed |
| 171 | nop |
| 172 | |
| 173 | ! Prefetch |
| 174 | prefetch: |
| 175 | setx prefetch_data, %g1, %g2 |
| 176 | prefetch [%g2], 0x0 |
| 177 | membar #Sync |
| 178 | setx 0x01234567, %g1, %g3 |
| 179 | ld [%g2], %l6 |
| 180 | cmp %l6, %g3 |
| 181 | bne test_failed |
| 182 | nop |
| 183 | |
| 184 | test_passed: |
| 185 | EXIT_GOOD |
| 186 | |
| 187 | test_failed: |
| 188 | EXIT_BAD |
| 189 | |
| 190 | |
| 191 | /************************************************************************ |
| 192 | Test case data start |
| 193 | ************************************************************************/ |
| 194 | .data |
| 195 | user_data_start: |
| 196 | .xword 0x0000000000000000 |
| 197 | .xword 0x1111111111111111 |
| 198 | .xword 0x2222222222222222 |
| 199 | .xword 0x3333333333333333 |
| 200 | .xword 0x4444444444444444 |
| 201 | .xword 0x5555555555555555 |
| 202 | .xword 0x6666666666666666 |
| 203 | .xword 0x7777777777777777 |
| 204 | .xword 0x8888888888888888 |
| 205 | .xword 0x9999999999999999 |
| 206 | .xword 0xaaaaaaaaaaaaaaaa |
| 207 | .xword 0xbbbbbbbbbbbbbbbb |
| 208 | .xword 0xcccccccccccccccc |
| 209 | .xword 0xdddddddddddddddd |
| 210 | .xword 0xeeeeeeeeeeeeeeee |
| 211 | .xword 0xffffffffffffffff |
| 212 | floating_point_data: |
| 213 | .xword 0x3f8000003f800000 ! 1.0, 1.0 single precision |
| 214 | .xword 0x4000000000000000 ! 2.0 double precision |
| 215 | .xword 000000000000000000 |
| 216 | vis_data: |
| 217 | .xword 0xa000000055000000 |
| 218 | prefetch_data: |
| 219 | .xword 0x0123456789abcdef |
| 220 | .xword 0xfedcba9876543210 |
| 221 | |
| 222 | .skip 128 |
| 223 | temp: |
| 224 | .skip 8192 |
| 225 | .end |
| 226 | |
| 227 | |
| 228 | |