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: 'ucmp' 17 isa: 18 title: Integer comparison 19 description: Perform specified signed or unsigned integer comparison between register and accumulator. 20 exceptions: 21 - x_none 22 commands: 23 - file-name: 'op_vs_8_eq' 24 isa: 25 instructions: 26 - sig: ucmp v:in:u32 27 acc: inout:u32->i32 28 prefix: unsigned 29 format: [pref_op_v_8] 30 check-type: check-positive 31 code-template: | 32 # test - compare equal values 33 ldai %s 34 movi v0, %s 35 ucmp v0 36 description: Check ucmp with equal values. 37 cases: 38 - values: 39 - '0' 40 - '0x00000000' 41 - values: 42 - '1' 43 - '0x00000001' 44 - values: 45 - '0x7fffffff' 46 - '2147483647' 47 - values: 48 - '0x80000000' 49 - '2147483648' 50 - values: 51 - '0xCAFEBABE' 52 - '3405691582' 53 54 - file-name: 'op_vs_8_lt' 55 isa: 56 instructions: 57 - sig: ucmp v:in:u32 58 acc: inout:u32->i32 59 prefix: unsigned 60 format: [pref_op_v_8] 61 tags: ['irtoc_ignore'] 62 check-type: check-positive 63 code-template: | 64 # test - check less than 65 ldai %s 66 movi v0, %s 67 ucmp v0 68 addi 1 69 description: Check ucmp with different values. 70 cases: 71 - values: 72 - '0' 73 - '0x00000001' 74 - values: 75 - '1' 76 - '0x80000000' 77 - values: 78 - '0x7fffffff' 79 - '2147483648' 80 - values: 81 - '0x80000000' 82 - '3147483648' 83 - values: 84 - '0xCAFEBABE' 85 - '3405691583' 86 87 - file-name: 'op_vs_8_gt' 88 isa: 89 instructions: 90 - sig: ucmp v:in:u32 91 acc: inout:u32->i32 92 prefix: unsigned 93 format: [pref_op_v_8] 94 check-type: check-positive 95 code-template: | 96 # test - check greater than 97 ldai %s 98 movi v0, %s 99 ucmp v0 100 subi 1 101 description: Check ucmp with different values. 102 tags: ['tsan', 'irtoc_ignore'] 103 cases: 104 - values: 105 - '0x00000001' 106 - '0' 107 - values: 108 - '0x80000000' 109 - '1' 110 - values: 111 - '2147483648' 112 - '0x7fffffff' 113 - values: 114 - '3147483648' 115 - '0x80000000' 116 - values: 117 - '3405691583' 118 - '0xCAFEBABE' 119 120 - file-name: 'op_vs_8_reg256' 121 isa: 122 instructions: 123 - sig: ucmp v:in:u32 124 acc: inout:u32->i32 125 prefix: unsigned 126 format: [pref_op_v_8] 127 check-type: exit-positive 128 runner-options: [compile-failure] 129 code-template: | 130 # 131 ucmp v256 132 description: Check ucmp with incorrect register numbers. 133 134 - file-name: 'op_vs_8_reg255' 135 isa: 136 instructions: 137 - sig: ucmp v:in:u32 138 acc: inout:u32->i32 139 prefix: unsigned 140 format: [pref_op_v_8] 141 check-type: exit-positive 142 runner-options: [compile-only] 143 code-template: | 144 # 145 ucmp v255 146 description: Check ucmp with correct register numbers. 147 148 - file-name: type 149 isa: 150 verification: 151 - v1_type 152 - acc_type 153 tags: ['verifier'] 154 runner-options: ['verifier-failure', 'verifier-config'] 155 header-template: [] 156 code-template: | 157 # 158 .record A {} 159 .record B {} 160 .record panda.String <external> 161 .record panda.Object <external> 162 .function i32 main() { 163 %s 164 *s 165 ucmp v0 166 check-type: exit-positive 167 description: Check 'ucmp' with incorrect register type. 168 template-cases: 169 - values: 170 - movi v0, 0 171 exclude: [val] 172 - values: 173 - fmovi v0, 0 174 - values: 175 - movi.64 v0, 0 176 - values: 177 - fmovi.64 v0, 0 178 - values: 179 - | 180 # 181 lda.type B 182 sta.obj v0 183 - values: 184 - | 185 # 186 lda.type B[] 187 sta.obj v0 188 - values: 189 - | 190 # 191 lda.type panda.String 192 sta.obj v0 193 - values: 194 - | 195 # 196 lda.str "string" 197 sta.obj v0 198 - values: 199 - | 200 # 201 movi v0, 10 202 newarr v0, v0, i32[] 203 - values: 204 - mov.null v0 205 206 cases: 207 - values: 208 - ldai 0 209 id: val 210 - values: 211 - fldai 0 212 - values: 213 - ldai.64 0 214 - values: 215 - fldai.64 0 216 - values: 217 - | 218 # 219 lda.type A 220 - values: 221 - | 222 # 223 lda.type A[] 224 - values: 225 - | 226 # 227 lda.type panda.String 228 - values: 229 - | 230 # 231 lda.str "string" 232 - values: 233 - | 234 # 235 movi v1, 10 236 newarr v1, v1, f64[] 237 lda.obj v1 238 239 - values: 240 - lda.null 241 242 - file-name: uninitialized_regs 243 isa: 244 instructions: 245 - sig: ucmp v:in:u32 246 acc: inout:u32->i32 247 prefix: unsigned 248 format: [pref_op_v_8] 249 description: Check 'ucmp' with uninitialized registers. 250 tags: ['verifier'] 251 runner-options: ['verifier-failure', 'verifier-config'] 252 header-template: [] 253 code-template: | 254 # 255 .function i32 main() { 256 %s 257 *s 258 ucmp %s 259 check-type: exit-positive 260 template-cases: 261 - values: 262 - '' 263 - v0 264 - values: 265 - movi v0, 0 266 - v0 267 exclude: [init] 268 - values: 269 - '' 270 - v7 271 - values: 272 - '' 273 - v15 274 - values: 275 - 'movi v15, 0' 276 - v15 277 exclude: [init] 278 - values: 279 - '' 280 - v128 281 - values: 282 - 'movi v128, 0' 283 - v128 284 exclude: [init] 285 - values: 286 - '' 287 - v255 288 - values: 289 - 'movi v255, 0' 290 - v255 291 exclude: [init] 292 cases: 293 - values: 294 - '' 295 - values: 296 - ldai 0 297 id: init 298