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