1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14definitions: [] 15tests: 16 - file-name: lda.64 17 isa: 18 title: Load accumulator from register 19 description: Moves register content into an accumulator. 20 exceptions: 21 - x_none 22 commands: 23 - file-name: op_vd_8 24 description: Check lda.64 moves register content into an accumulator. 25 isa: 26 instructions: 27 - sig: lda.64 v:in:b64 28 acc: out:b64 29 format: [op_v_8] 30 code-template: | 31 # 32 %s 33 ldai 0 34 return 35 err: 36 ldai 1 37 return 38 check-type: none 39 cases: 40 - values: 41 - "#{[ 42 '0', 43 '1', 44 '0xF', 45 '0xFF', 46 '0xFFF', 47 '0xFFFF', 48 '0xFFFFF', 49 '0xFFFFFF', 50 '0xFFFFFFF', 51 '0xFFFFFFFF', 52 '0xFFFFFFFFF', 53 '0xFFFFFFFFFF', 54 '0xFFFFFFFFFFF', 55 '0xFFFFFFFFFFFF', 56 '0xFFFFFFFFFFFFF', 57 '0xFFFFFFFFFFFFFF', 58 '0xFFFFFFFFFFFFFFF', 59 '0xFFFFFFFFFFFFFFFF', 60 '0x7F', 61 '0x7FF', 62 '0x7FFF', 63 '0x7FFFF', 64 '0x7FFFFF', 65 '0x7FFFFFF', 66 '0x7FFFFFFF', 67 '0x7FFFFFFFF', 68 '0x7FFFFFFFFF', 69 '0x7FFFFFFFFFF', 70 '0x7FFFFFFFFFFF', 71 '0x7FFFFFFFFFFFF', 72 '0x7FFFFFFFFFFFFF', 73 '0x7FFFFFFFFFFFFFF', 74 '0x7FFFFFFFFFFFFFFF', 75 '-1', 76 '-0xF', 77 '-0xFF', 78 '-0xFFF', 79 '-0xFFFF', 80 '-0xFFFFF', 81 '-0xFFFFFF', 82 '-0xFFFFFFF', 83 '-0xFFFFFFFF', 84 '-0xFFFFFFFFF', 85 '-0xFFFFFFFFFF', 86 '-0xFFFFFFFFFFF', 87 '-0xFFFFFFFFFFFF', 88 '-0xFFFFFFFFFFFFF', 89 '-0xFFFFFFFFFFFFFF', 90 '-0xFFFFFFFFFFFFFFF', 91 '-0xFFFFFFFFFFFFFFFF', 92 '-0x7F', 93 '-0x7FF', 94 '-0x7FFF', 95 '-0x7FFFF', 96 '-0x7FFFFF', 97 '-0x7FFFFFF', 98 '-0x7FFFFFFF', 99 '-0x7FFFFFFFF', 100 '-0x7FFFFFFFFF', 101 '-0x7FFFFFFFFFF', 102 '-0x7FFFFFFFFFFF', 103 '-0x7FFFFFFFFFFFF', 104 '-0x7FFFFFFFFFFFFF', 105 '-0x7FFFFFFFFFFFFFF', 106 '-0x7FFFFFFFFFFFFFFF' 107 ].map do |s| \" movi.64 v0, #{s}\\n lda.64 v0\\n cmp.64 v0\\n jnez err\\n\" end .join}" 108 109 - file-name: reg 110 isa: 111 instructions: 112 - sig: lda.64 v:in:b64 113 acc: out:b64 114 format: [op_v_8] 115 check-type: none 116 code-template: | 117 # 118 %s 119 ldai 0 120 return 121 err: 122 ldai 1 123 return 124 description: Check 'lda.64' with valid register numbers. 125 cases: 126 - values: 127 - "#{[*0..255].map do |i| \" movi.64 v#{i}, 0xDEADBEEFBADC0FFE\\n lda.64 v#{i}\\n cmp.64 v#{i}\\n jnez err\\n\" end .join}" 128 129 - file-name: reg_err 130 isa: 131 instructions: 132 - sig: lda.64 v:in:b64 133 acc: out:b64 134 format: [op_v_8] 135 check-type: none 136 runner-options: [compile-failure] 137 code-template: | 138 # 139 lda.64 %s 140 ldai 0 141 return 142 description: Check 'lda.64' with some invalid register numbers. 143 cases: 144 - values: 145 - v256 146 - values: 147 - a0 148 - values: 149 - v32565 150 - values: 151 - 0 152 153 - file-name: type 154 isa: 155 verification: 156 - v1_type 157 description: Check lda.64 with incorrect source register type. Accumulator type is not checked. 158 runner-options: ['verifier-failure', 'verifier-config'] 159 tags: ['verifier'] 160 header-template: [] 161 code-template: | 162 # 163 .record A {} 164 .record B {} 165 .record panda.String <external> 166 .record panda.Object <external> 167 .function i32 main() { 168 *s 169 %s 170 lda.64 v1 171 ldai 0 172 check-type: no-check 173 template-cases: 174 - values: 175 - | 176 # 177 lda.type B 178 - values: 179 - | 180 # 181 lda.type B[] 182 - values: 183 - | 184 # 185 lda.type panda.String 186 - values: 187 - | 188 # 189 lda.str "string" 190 - values: 191 - | 192 # 193 lda.type panda.Object 194 - values: 195 - | 196 # 197 movi v0, 10 198 newarr v0, v0, i32[] 199 lda.obj v0 200 - values: 201 - lda.null 202 - values: 203 - ldai 0 204 - values: 205 - ldai.64 0 206 - values: 207 - fldai.64 0 208 cases: 209 - values: 210 - | 211 # 212 lda.type A 213 sta.obj v1 214 - values: 215 - | 216 # 217 lda.type A[] 218 sta.obj v1 219 - values: 220 - | 221 # 222 lda.type panda.String 223 sta.obj v1 224 - values: 225 - | 226 # 227 lda.str "string" 228 sta.obj v1 229 230 - values: 231 - | 232 # 233 lda.type panda.Object 234 sta.obj v1 235 - values: 236 - | 237 # 238 movi v1, 10 239 newarr v1, v1, f64[] 240 - values: 241 - mov.null v1 242 - values: 243 - movi v1, 0 244 - values: 245 - fmovi v1, 0 246 bugid: ['6094'] 247 248 - file-name: uninitialized_regs 249 isa: 250 instructions: 251 - sig: lda.64 v:in:b64 252 acc: out:b64 253 format: [op_v_8] 254 description: Check lda.64 with uninitialized registers. 255 tags: ['verifier'] 256 runner-options: ['verifier-failure', 'verifier-config'] 257 header-template: [] 258 code-template: | 259 # 260 .function i32 main() { 261 lda.64 %s 262 ldai 0 263 check-type: no-check 264 cases: 265 - values: 266 - v0 267 - values: 268 - v8 269 - values: 270 - v15 271 - values: 272 - v255 273