# 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: "mul" isa: title: Three address binary operation description: Perform specified binary operation on two registers and store result into accumulator exceptions: - x_none commands: - file-name: "op_vs1_4_vs2_4_zero" isa: instructions: - sig: mul v1:in:i32, v2:in:i32 acc: out:i32 format: [op_v1_4_v2_4] code-template: | # movi v0, 0 movi v1, %s mul v0, v1 movi v0, 0 jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check mul with zero and various values. cases: - values: - "0" - values: - "1" - values: - "-1" - values: - "0x7FFFFFFF" - values: - "0x80000000" - values: - "-0x7FFFFFFF" - values: - "-0x80000000" - values: - "0xFFFFFFFF" - values: - "-0xFFFFFFFF" - file-name: "op_vs1_4_vs2_4_pone" isa: instructions: - sig: mul v1:in:i32, v2:in:i32 acc: out:i32 format: [op_v1_4_v2_4] code-template: | # movi v0, 1 movi v1, %s mul v0, v1 movi v0, %s jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check mul with +1 and various values. cases: - values: - "0" - "0" - values: - "1" - "1" - values: - "-1" - "-1" - values: - "0x7FFFFFFF" - "0x7FFFFFFF" - values: - "0x80000000" - "0x80000000" - values: - "-0x7FFFFFFF" - "-0x7FFFFFFF" - values: - "-0x80000000" - "-0x80000000" - values: - "0xFFFFFFFF" - "0xFFFFFFFF" - values: - "-0xFFFFFFFF" - "-0xFFFFFFFF" - file-name: "op_vs1_4_vs2_4_none" isa: instructions: - sig: mul v1:in:i32, v2:in:i32 acc: out:i32 format: [op_v1_4_v2_4] code-template: | # movi v0, -1 movi v1, %s mul v0, v1 movi v0, %s jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check mul with -1 and various values. cases: - values: - "0" - "0" - values: - "1" - "-1" - values: - "-1" - "1" - values: - "0x7FFFFFFF" - "-0x7FFFFFFF" - values: - "0x80000000" - "0x80000000" bugid: ['966'] - values: - "-0x7FFFFFFF" - "0x7FFFFFFF" - values: - "-0x80000000" - "0x80000000" bugid: ['966'] - values: - "0xFFFFFFFF" - "1" - values: - "-0xFFFFFFFF" - "-1" - file-name: "op_vs1_4_vs2_4_pmax" isa: instructions: - sig: mul v1:in:i32, v2:in:i32 acc: out:i32 format: [op_v1_4_v2_4] code-template: | # movi v0, 0x7FFFFFFF movi v1, %s mul v0, v1 movi v0, %s jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check mul with +max and various values. cases: - values: - "0" - "0" - values: - "1" - "0x7FFFFFFF" - values: - "-1" - "0x80000001" - values: - "0x7FFFFFFF" - "1" bugid: ['966'] - values: - "-0x7FFFFFFF" - "-1" bugid: ['966'] - values: - "0x80000000" - "0x80000000" bugid: ['966'] - values: - "-0x80000000" - "0x80000000" bugid: ['966'] - values: - "0xFFFFFFFF" - "0x80000001" - values: - "-0xFFFFFFFF" - "0x7FFFFFFF" - file-name: "op_vs1_4_vs2_4_nmax" bugid: ['966'] isa: instructions: - sig: mul v1:in:i32, v2:in:i32 acc: out:i32 format: [op_v1_4_v2_4] code-template: | # movi v0, -0x80000000 movi v1, %s mul v0, v1 movi v0, %s jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check mul with -max and various values. cases: - values: - "0" - "0" - values: - "1" - "0x80000000" - values: - "-1" - "0x80000000" - values: - "0x7FFFFFFF" - "0x80000000" - values: - "-0x7FFFFFFF" - "0x80000000" - values: - "0x80000000" - "0x0" - values: - "-0x80000000" - "0x0" - values: - "0xFFFFFFFF" - "0x80000000" - values: - "-0xFFFFFFFF" - "0x80000000" - file-name: "vals" isa: instructions: - sig: mul v1:in:i32, v2:in:i32 acc: out:i32 format: [op_v1_4_v2_4] code-template: | # movi v0, %s movi v1, %s mul v0, v1 movi v0, %s jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: tags: ['tsan'] bugid: ['966'] description: Check mul with various values. cases: - values: - "0x7A2CE254" - "0xFB676533" - "0x78083ABC" - values: - "0x6F7788C3" - "0x65EB9775" - "0xED4D861F" - values: - "0x801EF150" - "0x29F1C73" - "0x70FB26F0" - values: - "0xA6AB8140" - "0x1D900575" - "0x79E85240" - values: - "0x46689505" - "0xADE64802" - "0x3A38920A" - values: - "0x62C511AC" - "0xD933351D" - "0x4E3F9C7C" - values: - "0x59BB5F3E" - "0x8E8C2463" - "0x86C28CFA" - values: - "0x55255365" - "0x98E808C3" - "0x9191ADEF" - values: - "0x9664221" - "0xF7F5AC4D" - "0xA8C50FED" - values: - "0xC37EF875" - "0xB09DAC86" - "0x7325A93E" - file-name: "vals_mod32_1" isa: instructions: - sig: mul v1:in:i32, v2:in:i32 acc: out:i32 format: [op_v1_4_v2_4] code-template: | # movi v0, %s movi v1, %s mul v0, v1 movi.64 v0, %s cmp.64 v0 tags: ["verifier"] bugid: ['966', '1324', '2072'] runner-options: ['verifier-failure', 'verifier-config'] description: Check mul with incorrect register types. cases: - values: - "0x7FFFFFFF" - "2" - "0xFFFFFFFFFFFFFFFE" - values: - "0x7FFFFFFF" - "-2" - "2" - values: - "0x80000000" - "2" - "0" - file-name: "vals_mod32_2" runner-options: ['verifier-failure', 'verifier-config'] tags: ["verifier"] bugid: ['966', '1324'] isa: instructions: - sig: mul v1:in:i32, v2:in:i32 acc: out:i32 format: [op_v1_4_v2_4] code-template: | # movi.64 v0, %s movi.64 v1, %s mul v0, v1 movi.64 v0, %s cmp.64 v0 description: Check mul with incorrect register types. cases: - values: - "0x17FFFFFFF" - "0x100000002" - "0xFFFFFFFFFFFFFFFE" - values: - "0x777777777FFFFFFF" - "-2" - "2" - values: - "0x7654321080000000" - "2" - "0" - file-name: "regs" isa: instructions: - sig: mul v1:in:i32, v2:in:i32 acc: out:i32 format: [op_v1_4_v2_4] runner-options: ['compile-only'] code-template: | # mul %s, %s check-type: none description: Check mul with various register numbers. cases: - values: - v0 - v15 - values: - v0 - v16 runner-options: - compile-failure - values: - v15 - v0 - values: - v16 - v0 runner-options: - compile-failure - file-name: type isa: verification: - v1_type - v2_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 mul v0, v1 check-type: exit-positive description: Check 'mul' with incorrect register types. template-cases: - values: - movi v0, 0 exclude: [val] - values: - movi.64 v0, 0 - values: - fmovi 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.type panda.Object sta.obj v0 - values: - | # movi v0, 10 newarr v0, v0, i32[] - values: - mov.null v0 cases: - values: - movi v1, 0 id: val - values: - movi.64 v1, 0 - values: - fmovi v1, 0 - values: - fmovi.64 v1, 0 - values: - | # lda.type A sta.obj v1 - values: - | # lda.type A[] sta.obj v1 - values: - | # lda.type panda.String sta.obj v1 - values: - | # lda.type panda.Object sta.obj v1 - values: - | # movi v1, 10 newarr v1, v1, f64[] - values: - mov.null v1 - file-name: uninitialized_regs isa: instructions: - sig: mul v1:in:i32, v2:in:i32 acc: out:i32 format: [op_v1_4_v2_4] description: Check 'mul' with uninitialized registers. tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] code-template: | # %s *s mul %s, *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] cases: - values: - '' - v1 - values: - movi v1, 0 - v1 id: init - values: - '' - v8 - values: - '' - v14