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 14--- 15definitions: [] 16tests: 17 - file-name: andi 18 isa: 19 title: Two address binary operation with immediate on accumulator 20 description: > 21 Perform specified binary operation on accumulator and immediate and store result into accumulator. 22 Immediate is sign extended to operand size. 23 exceptions: 24 - x_none 25 commands: 26 - file-name: op_imm_32_zero 27 isa: 28 instructions: 29 - sig: andi imm:i32 30 acc: inout:i32 31 format: [op_imm_32] 32 code-template: | 33 # 34 ldai 0 35 andi %s 36 movi v0, 0 37 jne v0, set_failure 38 ldai 0 39 return 40 set_failure: 41 ldai 1 42 return 43 check-type: none 44 description: Check `andi` with zero and various values. 45 cases: 46 - values: ["0"] 47 - values: ["1"] 48 - values: ["-1"] 49 - values: ["0x7FFFFFFF"] 50 - values: ["-0x7FFFFFFF"] 51 - values: ["0x80000000"] 52 - values: ["-0x80000000"] 53 - values: ["0xFFFFFFFF"] 54 - values: ["-0xFFFFFFFF"] 55 56 57 - file-name: op_imm_32_pone 58 isa: 59 instructions: 60 - sig: andi imm:i32 61 acc: inout:i32 62 format: [op_imm_32] 63 code-template: | 64 # 65 ldai 1 66 andi %s 67 movi v0, %s 68 jne v0, set_failure 69 ldai 0 70 return 71 set_failure: 72 ldai 1 73 return 74 check-type: none 75 description: Check `andi` with +1 and various values. 76 cases: 77 - values: ["0", "0x0"] 78 - values: ["1", "0x1"] 79 - values: ["-1", "0x1"] 80 - values: ["0x7FFFFFFF", "0x1"] 81 - values: ["-0x7FFFFFFF", "0x1"] 82 - values: ["0x80000000", "0x0"] 83 - values: ["-0x80000000", "0x0"] 84 - values: ["0xFFFFFFFF", "0x1"] 85 - values: ["-0xFFFFFFFF", "0x1"] 86 87 88 - file-name: op_imm_32_none 89 isa: 90 instructions: 91 - sig: andi imm:i32 92 acc: inout:i32 93 format: [op_imm_32] 94 code-template: | 95 # 96 ldai -1 97 andi %s 98 movi v0, %s 99 jne v0, set_failure 100 ldai 0 101 return 102 set_failure: 103 ldai 1 104 return 105 check-type: none 106 description: Check `andi` with -1 and various values. 107 cases: 108 - values: ["0", "0x0"] 109 - values: ["1", "0x1"] 110 - values: ["-1", "0xFFFFFFFF"] 111 - values: ["0x7FFFFFFF", "0x7FFFFFFF"] 112 - values: ["-0x7FFFFFFF", "0x80000001"] 113 - values: ["0x80000000", "0x80000000"] 114 - values: ["-0x80000000", "0x80000000"] 115 - values: ["0xFFFFFFFF", "0xFFFFFFFF"] 116 - values: ["-0xFFFFFFFF", "0x1"] 117 118 119 - file-name: op_imm_32_pmax 120 isa: 121 instructions: 122 - sig: andi imm:i32 123 acc: inout:i32 124 format: [op_imm_32] 125 code-template: | 126 # 127 ldai 0x7FFFFFFF 128 andi %s 129 movi v0, %s 130 jne v0, set_failure 131 ldai 0 132 return 133 set_failure: 134 ldai 1 135 return 136 check-type: none 137 description: Check `andi` with +max and various values. 138 cases: 139 - values: ["0", "0x0"] 140 - values: ["1", "0x1"] 141 - values: ["-1", "0x7FFFFFFF"] 142 - values: ["0x7FFFFFFF", "0x7FFFFFFF"] 143 - values: ["-0x7FFFFFFF", "0x1"] 144 - values: ["0x80000000", "0x0"] 145 - values: ["-0x80000000", "0x0"] 146 - values: ["0xFFFFFFFF", "0x7FFFFFFF"] 147 - values: ["-0xFFFFFFFF", "0x1"] 148 149 150 - file-name: op_imm_32_nmax 151 isa: 152 instructions: 153 - sig: andi imm:i32 154 acc: inout:i32 155 format: [op_imm_32] 156 code-template: | 157 # 158 ldai -0x80000000 159 andi %s 160 movi v0, %s 161 jne v0, set_failure 162 ldai 0 163 return 164 set_failure: 165 ldai 1 166 return 167 check-type: none 168 description: Check `andi` with -max and various values. 169 cases: 170 - values: ["0", "0x0"] 171 - values: ["1", "0x0"] 172 - values: ["-1", "0x80000000"] 173 - values: ["0x7FFFFFFF", "0x0"] 174 - values: ["-0x7FFFFFFF", "0x80000000"] 175 - values: ["0x80000000", "0x80000000"] 176 - values: ["-0x80000000", "0x80000000"] 177 - values: ["0xFFFFFFFF", "0x80000000"] 178 - values: ["-0xFFFFFFFF", "0x0"] 179 180 181 - file-name: vals 182 isa: 183 instructions: 184 - sig: andi imm:i32 185 acc: inout:i32 186 format: [op_imm_32] 187 code-template: | 188 # 189 ldai %s 190 andi %s 191 movi v0, %s 192 jne v0, set_failure 193 ldai 0 194 return 195 set_failure: 196 ldai 1 197 return 198 check-type: none 199 description: Check `andi` with various values. 200 tags: ['tsan'] 201 cases: 202 - values: ["0x2F588FCE", "0x92D0BE61", "0x2508E40"] 203 - values: ["0xFDD750F7", "0x8DEDAFA6", "0x8DC500A6"] 204 - values: ["0x550BDA41", "0x753E04EF", "0x550A0041"] 205 - values: ["0x18C66A4A", "0x209E1E3", "0x6042"] 206 - values: ["0x92B9866", "0xC42D014", "0x8029004"] 207 - values: ["0xFAA76C6D", "0xBD0634D1", "0xB8062441"] 208 - values: ["0xDD868BD3", "0x3D37BD89", "0x1D068981"] 209 - values: ["0x54509EE1", "0xE6DA082F", "0x44500821"] 210 - values: ["0x6BB97107", "0x1DF6E02E", "0x9B06006"] 211 - values: ["0x8325D28B", "0x90A3B91E", "0x8021900A"] 212 213 214 - file-name: type 215 isa: 216 verification: 217 - acc_type 218 tags: ['verifier'] 219 runner-options: ['verifier-failure', 'verifier-config'] 220 header-template: [] 221 code-template: | 222 # 223 .record panda.Object <external> 224 .function i32 main() { 225 %s 226 andi 0 227 check-type: exit-positive 228 description: Check 'andi' with incorrect acc type. 229 cases: 230 - values: [ldai.64 0] 231 - values: [fldai 0] 232 bugid: ['7315'] 233 - values: [fldai.64 0] 234 - values: [lda.null] 235 - values: [lda.type panda.Object] 236 - values: ['lda.type i32[]'] 237 - values: [lda.str ""] 238 - values: 239 - | 240 # 241 newobj v0, panda.Object 242 lda.obj v0 243 - values: 244 - | 245 # 246 movi v0, 10 247 newarr v0, v0, i32[] 248 lda.obj v0 249 250 251 - file-name: uninitialized_acc 252 bugid: ['2260'] 253 isa: 254 instructions: 255 - sig: andi imm:i32 256 acc: inout:i32 257 format: [op_imm_32] 258 description: Check 'andi' with uninitialized accumulator. 259 tags: ['verifier'] 260 runner-options: ['verifier-failure', 'verifier-config'] 261 code-template: | 262 # 263 andi 0 264 check-type: exit-positive 265