# Copyright (c) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. definitions: [] tests: - file-name: 'ucmp' isa: title: Integer comparison description: Perform specified signed or unsigned integer comparison between register and accumulator. exceptions: - x_none commands: - file-name: 'op_vs_8_eq' isa: instructions: - sig: ucmp v:in:u32 acc: inout:u32->i32 prefix: unsigned format: [pref_op_v_8] check-type: check-positive code-template: | # test - compare equal values ldai %s movi v0, %s ucmp v0 description: Check ucmp with equal values. cases: - values: - '0' - '0x00000000' - values: - '1' - '0x00000001' - values: - '0x7fffffff' - '2147483647' - values: - '0x80000000' - '2147483648' - values: - '0xCAFEBABE' - '3405691582' - file-name: 'op_vs_8_lt' isa: instructions: - sig: ucmp v:in:u32 acc: inout:u32->i32 prefix: unsigned format: [pref_op_v_8] tags: ['irtoc_ignore'] check-type: check-positive code-template: | # test - check less than ldai %s movi v0, %s ucmp v0 addi 1 description: Check ucmp with different values. cases: - values: - '0' - '0x00000001' - values: - '1' - '0x80000000' - values: - '0x7fffffff' - '2147483648' - values: - '0x80000000' - '3147483648' - values: - '0xCAFEBABE' - '3405691583' - file-name: 'op_vs_8_gt' isa: instructions: - sig: ucmp v:in:u32 acc: inout:u32->i32 prefix: unsigned format: [pref_op_v_8] check-type: check-positive code-template: | # test - check greater than ldai %s movi v0, %s ucmp v0 subi 1 description: Check ucmp with different values. tags: ['tsan', 'irtoc_ignore'] cases: - values: - '0x00000001' - '0' - values: - '0x80000000' - '1' - values: - '2147483648' - '0x7fffffff' - values: - '3147483648' - '0x80000000' - values: - '3405691583' - '0xCAFEBABE' - file-name: 'op_vs_8_reg256' isa: instructions: - sig: ucmp v:in:u32 acc: inout:u32->i32 prefix: unsigned format: [pref_op_v_8] check-type: exit-positive runner-options: [compile-failure] code-template: | # ucmp v256 description: Check ucmp with incorrect register numbers. - file-name: 'op_vs_8_reg255' isa: instructions: - sig: ucmp v:in:u32 acc: inout:u32->i32 prefix: unsigned format: [pref_op_v_8] check-type: exit-positive runner-options: [compile-only] code-template: | # ucmp v255 description: Check ucmp with correct register numbers. - file-name: type isa: verification: - v1_type - acc_type tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] header-template: [] code-template: | # .record A {} .record B {} .record panda.String .record panda.Object .function i32 main() { %s *s ucmp v0 check-type: exit-positive description: Check 'ucmp' with incorrect register type. template-cases: - values: - movi v0, 0 exclude: [val] - values: - fmovi v0, 0 - values: - movi.64 v0, 0 - values: - fmovi.64 v0, 0 - values: - | # lda.type B sta.obj v0 - values: - | # lda.type B[] sta.obj v0 - values: - | # lda.type panda.String sta.obj v0 - values: - | # lda.str "string" sta.obj v0 - values: - | # movi v0, 10 newarr v0, v0, i32[] - values: - mov.null v0 cases: - values: - ldai 0 id: val - values: - fldai 0 - values: - ldai.64 0 - values: - fldai.64 0 - values: - | # lda.type A - values: - | # lda.type A[] - values: - | # lda.type panda.String - values: - | # lda.str "string" - values: - | # movi v1, 10 newarr v1, v1, f64[] lda.obj v1 - values: - lda.null - file-name: uninitialized_regs isa: instructions: - sig: ucmp v:in:u32 acc: inout:u32->i32 prefix: unsigned format: [pref_op_v_8] description: Check 'ucmp' with uninitialized registers. tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] header-template: [] code-template: | # .function i32 main() { %s *s ucmp %s check-type: exit-positive template-cases: - values: - '' - v0 - values: - movi v0, 0 - v0 exclude: [init] - values: - '' - v7 - values: - '' - v15 - values: - 'movi v15, 0' - v15 exclude: [init] - values: - '' - v128 - values: - 'movi v128, 0' - v128 exclude: [init] - values: - '' - v255 - values: - 'movi v255, 0' - v255 exclude: [init] cases: - values: - '' - values: - ldai 0 id: init