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: "fcmpl.64" 17 isa: 18 title: Floating-point comparison 19 description: Perform specified floating point comparison between register and accumulator. 20 exceptions: 21 - x_none 22 commands: 23 - file-name: "op_vs_8_zero" 24 isa: 25 instructions: 26 - sig: fcmpl.64 v:in:f64 27 acc: inout:f64->i32 28 format: [op_v_8] 29 check-type: check-positive 30 description: Check fcmpl.64 compares zero with other zero values. 31 code-template: | 32 # 33 fldai.64 %s 34 fmovi.64 v0, %s 35 fcmpl.64 v0 36 cases: 37 - values: 38 - "0.0" 39 - "0.0" 40 - values: 41 - "-0.0" 42 - "-0.0" 43 - values: 44 - "-0.0" 45 - "0.0" 46 - values: 47 - "0.0" 48 - "-0.0" 49 50 - file-name: "op_vs_8_nan" 51 isa: 52 instructions: 53 - sig: fcmpl.64 v:in:f64 54 acc: inout:f64->i32 55 format: [op_v_8] 56 check-type: check-acc-minus-1 57 code-template: | 58 # test - check binary representation and comparison of FP literals - NaN 59 fldai.64 0x7ff8000000000000 60 fmovi.64 v0, %s 61 fcmpl.64 v0 62 description: Check fcmpl.64 compares NaN values. 63 cases: 64 - values: 65 - "0x7ff8000000000000" 66 - values: 67 - "0x7ff8000000000001" 68 - values: 69 - "0x7ff8000000000010" 70 - values: 71 - "0x7fffffffffffffff" 72 - values: 73 - "0xFFFFFFFFFFFFFFFF" 74 - values: 75 - "0x7ff8123456789012" 76 - values: 77 # +Inf 78 - "0x7ff0000000000000" 79 description: Check fcmpl.64 compares NaN with +Inf 80 - values: 81 # -Inf 82 - "0xfff0000000000000" 83 description: Check fcmpl.64 compares NaN with -Inf 84 85 - file-name: "op_vs_8_nan_numbers_1" 86 isa: 87 instructions: 88 - sig: fcmpl.64 v:in:f64 89 acc: inout:f64->i32 90 format: [op_v_8] 91 check-type: check-acc-minus-1 92 description: Check fcmpl.64 compares NaN with various values. 93 code-template: | 94 # test - check comparison of NaN with values 95 fldai.64 0x7ff8000000000000 # One of valid NaN values 96 fmovi.64 v0, %s 97 fcmpl.64 v0 98 cases: 99 - values: 100 - "4e300" 101 - values: 102 - "0.0" 103 - values: 104 - "-1.0e20" 105 106 - file-name: "op_vs_8_numbers_2" 107 isa: 108 instructions: 109 - sig: fcmpl.64 v:in:f64 110 acc: inout:f64->i32 111 format: [op_v_8] 112 check-type: check-positive 113 code-template: | 114 # test - check comparison of values 115 fldai.64 %s 116 fmovi.64 v0, %s 117 movi v1, %s 118 fcmpl.64 v0 119 jne v1, set_failure 120 ldai 0 121 jmp fall_through 122 set_failure: 123 ldai 1 124 fall_through: 125 description: Check fcmpl.64 compares various values. 126 tags: ['tsan'] 127 cases: 128 - values: 129 - "1.0" 130 - "0.0" 131 - "1" 132 - values: 133 - "12345678.9098765" 134 - "12345678.9098764" 135 - "1" 136 - values: 137 - "12345678.9098765" 138 - "-12345678.9098765" 139 - "1" 140 - values: 141 - "-1.0" 142 - "0.0" 143 - "-1" 144 - values: 145 - "-12345678.9098765" 146 - "0.0" 147 - "-1" 148 - values: 149 - "-12345678.9098765" 150 - "12345678.9098765" 151 - "-1" 152 - values: 153 - "-12345678.9098765" 154 - "12345678.9098765" 155 - "-1" 156 - file-name: "op_vs_8_pinf" 157 isa: 158 instructions: 159 - sig: fcmpl.64 v:in:f64 160 acc: inout:f64->i32 161 format: [op_v_8] 162 check-type: check-positive 163 description: Check fcmpl.64 compares positive Inf with various values. 164 code-template: | 165 # test - check comparison of values 166 # +Inf 167 fldai.64 0x7ff0000000000000 168 fmovi.64 v0, %s 169 movi v1, 1 170 fcmpl.64 v0 171 jne v1, set_failure 172 ldai 0 173 jmp fall_through 174 set_failure: 175 ldai 1 176 fall_through: 177 cases: 178 - values: 179 - "1.0" 180 - values: 181 - "12345678.9098765" 182 - values: 183 - "-12345678.9098765" 184 - values: 185 - "-1.0" 186 - values: 187 - "4e300" 188 - values: 189 - "-4e300" 190 - file-name: "op_vs_8_ninf" 191 isa: 192 instructions: 193 - sig: fcmpl.64 v:in:f64 194 acc: inout:f64->i32 195 format: [op_v_8] 196 check-type: check-positive 197 description: Check fcmpl.64 compares negative Inf with various values. 198 code-template: | 199 # test - check comparison of values 200 # -Inf 201 fldai.64 0xfff0000000000000 202 fmovi.64 v0, %s 203 movi v1, -1 204 fcmpl.64 v0 205 jne v1, set_failure 206 ldai 0 207 jmp fall_through 208 set_failure: 209 ldai 1 210 fall_through: 211 cases: 212 - values: 213 - "1.0" 214 - values: 215 - "12345678.9098765" 216 - values: 217 - "-12345678.9098765" 218 - values: 219 - "-1.0" 220 - values: 221 - "4e300" 222 - values: 223 - "-4e300" 224 225 - file-name: "op_vs_8_inf" 226 isa: 227 instructions: 228 - sig: fcmpl.64 v:in:f64 229 acc: inout:f64->i32 230 format: [op_v_8] 231 check-type: check-positive 232 code-template: | 233 # test - check comparison of values 234 fldai.64 %s 235 # +Inf 236 fmovi.64 v0, %s 237 movi v1, %s 238 fcmpl.64 v0 239 jne v1, set_failure 240 ldai 0 241 jmp fall_through 242 set_failure: 243 ldai 1 244 fall_through: 245 cases: 246 - values: 247 # -Inf 248 - "0xfff0000000000000" 249 - "0x7ff0000000000000" 250 - "-1" 251 - values: 252 - "0x7ff0000000000000" 253 # -Inf 254 - "0xfff0000000000000" 255 - "+1" 256 257 - file-name: "incorrect_register" 258 isa: 259 instructions: 260 - sig: fcmpl.64 v:in:f64 261 acc: inout:f64->i32 262 format: [op_v_8] 263 check-type: none 264 runner-options: [compile-failure] 265 description: Check fcmpl.64 with incorrect register numbers. 266 code-template: | 267 # 268 fcmpl.64 %s 269 cases: 270 - values: [v256] 271 - values: [a0] 272 - values: [0] 273 - values: ['1.1'] 274 - values: [1.1] 275 276 - file-name: "applicable_register" 277 isa: 278 instructions: 279 - sig: fcmpl.64 v:in:f64 280 acc: inout:f64->i32 281 format: [op_v_8] 282 check-type: none 283 runner-options: [compile-only] 284 description: Check fcmpl.64 with correct register numbers. 285 code-template: | 286 # 287 fcmpl.64 %s 288 cases: 289 - values: [v0] 290 - values: [v8] 291 - values: [v16] 292 - values: [v64] 293 - values: [v128] 294 - values: [v255] 295 296 - file-name: type 297 isa: 298 instructions: 299 - sig: fcmpl.64 v:in:f64 300 acc: inout:f64->i32 301 format: [op_v_8] 302 verification: 303 - v1_type 304 - acc_type 305 tags: ['verifier'] 306 runner-options: ['verifier-failure', 'verifier-debug-config'] 307 header-template: [] 308 code-template: | 309 # 310 .record A {} 311 .record B {} 312 .record panda.String <external> 313 .record panda.Object <external> 314 .function i32 main() { 315 %s 316 *s 317 fcmpl.64 v0 318 ldai 0 319 check-type: no-check 320 description: Check 'fcmpl.64' with incorrect register type. 321 template-cases: 322 - values: 323 - movi v0, 0 324 - values: 325 - movi.64 v0, 0 326 - values: 327 - fmovi.64 v0, 0 328 exclude: [val] 329 - values: 330 - | 331 # 332 lda.type B 333 sta.obj v0 334 - values: 335 - | 336 # 337 lda.type B[] 338 sta.obj v0 339 - values: 340 - | 341 # 342 lda.type panda.String 343 sta.obj v0 344 - values: 345 - | 346 # 347 lda.str "string" 348 sta.obj v0 349 - values: 350 - | 351 # 352 movi v0, 10 353 newarr v0, v0, i32[] 354 - values: 355 - mov.null v0 356 357 cases: 358 - values: 359 - ldai 0 360 - values: 361 - ldai.64 0 362 - values: 363 - fldai.64 0 364 id: val 365 - values: 366 - | 367 # 368 lda.type A 369 - values: 370 - | 371 # 372 lda.type A[] 373 - values: 374 - | 375 # 376 lda.type panda.String 377 - values: 378 - | 379 # 380 lda.str "string" 381 - values: 382 - | 383 # 384 movi v1, 10 385 newarr v1, v1, f64[] 386 lda.obj v1 387 - values: 388 - lda.null 389 390 - file-name: uninitialized_regs 391 isa: 392 instructions: 393 - sig: fcmpl.64 v:in:f64 394 acc: inout:f64->i32 395 format: [op_v_8] 396 description: Check 'fcmpl.64' with uninitialized registers. 397 tags: ['verifier'] 398 runner-options: ['verifier-failure', 'verifier-debug-config'] 399 header-template: [] 400 code-template: | 401 # 402 .function i32 main() { 403 %s 404 *s 405 fcmpl.64 %s 406 ldai 0 407 check-type: no-check 408 template-cases: 409 - values: 410 - '' 411 - v0 412 - values: 413 - fmovi.64 v0, 0 414 - v0 415 exclude: [init] 416 - values: 417 - '' 418 - v7 419 - values: 420 - '' 421 - v15 422 - values: 423 - 'fmovi.64 v15, 0' 424 - v15 425 exclude: [init] 426 - values: 427 - '' 428 - v128 429 - values: 430 - 'fmovi.64 v128, 0' 431 - v128 432 exclude: [init] 433 - values: 434 - '' 435 - v255 436 - values: 437 - 'fmovi.64 v255, 0' 438 - v255 439 exclude: [init] 440 cases: 441 - values: 442 - '' 443 - values: 444 - fldai.64 0 445 id: init 446