# 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: "shr2" isa: title: Two address binary operation on accumulator description: > Perform specified binary operation on accumulator and register and store result into accumulator exceptions: - x_none commands: - file-name: "op_vs_8_zero" isa: instructions: - sig: shr2 v:in:i32 acc: inout:i32 prefix: bit format: [pref_op_v_8] code-template: | # ldai 0 movi v0, %s mov v1, v0 shr2 v0 movi v0, 0 jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check shr2 with zero and various values. cases: - values: - "0" - values: - "1" - values: - "-1" bugid: ['1387'] - values: - "0x7FFFFFFF" bugid: ['1387'] - values: - "0x80000000" bugid: ['1387'] - values: - "-0x7FFFFFFF" bugid: ['1387'] - values: - "-0x80000000" bugid: ['1387'] - values: - "0xFFFFFFFF" bugid: ['1387'] - values: - "-0xFFFFFFFF" - file-name: "op_vs_8_pone" isa: instructions: - sig: shr2 v:in:i32 acc: inout:i32 prefix: bit format: [pref_op_v_8] code-template: | # ldai 1 movi v0, %s shr2 v0 movi v0, %s jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check shr2 with +1 and various values. cases: - values: - "0" - "1" - values: - "1" - "0" - values: - "-1" - "0" bugid: ['1387'] - values: - "0x7FFFFFFF" - "0" bugid: ['1387'] - values: - "0x80000000" - "1" bugid: ['1387'] - values: - "-0x7FFFFFFF" - "0" bugid: ['1387'] - values: - "-0x80000000" - "1" bugid: ['1387'] - values: - "0xFFFFFFFF" - "0" bugid: ['1387'] - values: - "-0xFFFFFFFF" - "0" - file-name: "op_vs_8_none" isa: instructions: - sig: shr2 v:in:i32 acc: inout:i32 prefix: bit format: [pref_op_v_8] code-template: | # ldai -1 movi v0, %s shr2 v0 movi v0, %s jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check shr2 with -1 and various values. cases: - values: - "0" - "0xFFFFFFFF" - values: - "1" - "0x7FFFFFFF" - values: - "-1" - "1" bugid: ['1387'] - values: - "0x7FFFFFFF" - "1" bugid: ['1387'] - values: - "0x80000000" - "0xFFFFFFFF" bugid: ['1387'] - values: - "-0x7FFFFFFF" - "0x7FFFFFFF" bugid: ['1387'] - values: - "-0x80000000" - "0xFFFFFFFF" bugid: ['1387'] - values: - "0xFFFFFFFF" - "1" bugid: ['1387'] - values: - "-0xFFFFFFFF" - "0x7FFFFFFF" - file-name: "op_vs_8_pmax" isa: instructions: - sig: shr2 v:in:i32 acc: inout:i32 prefix: bit format: [pref_op_v_8] code-template: | # ldai 0x7FFFFFFF movi v0, %s shr2 v0 movi v0, %s jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check shr2 with +max and various values. cases: - values: - "0" - "0x7FFFFFFF" - values: - "1" - "0x3FFFFFFF" - values: - "-1" - "0" bugid: ['1387'] - values: - "0x7FFFFFFF" - "0" bugid: ['1387'] - values: - "0x80000000" - "0x7FFFFFFF" bugid: ['1387'] - values: - "-0x7FFFFFFF" - "0x3FFFFFFF" bugid: ['1387'] - values: - "-0x80000000" - "0x7FFFFFFF" bugid: ['1387'] - values: - "0xFFFFFFFF" - "0" bugid: ['1387'] - values: - "-0xFFFFFFFF" - "0x3FFFFFFF" - file-name: "op_vs_8_nmax" isa: instructions: - sig: shr2 v:in:i32 acc: inout:i32 prefix: bit format: [pref_op_v_8] code-template: | # ldai -0x80000000 movi v0, %s shr2 v0 movi v0, %s jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check shr2 with -max and various values. cases: - values: - "0" - "0x80000000" - values: - "1" - "0x40000000" - values: - "-1" - "1" bugid: ['1387'] - values: - "0x7FFFFFFF" - "1" bugid: ['1387'] - values: - "0x80000000" - "0x80000000" bugid: ['1387'] - values: - "-0x7FFFFFFF" - "0x40000000" bugid: ['1387'] - values: - "-0x80000000" - "0x80000000" bugid: ['1387'] - values: - "0xFFFFFFFF" - "1" bugid: ['1387'] - values: - "-0xFFFFFFFF" - "0x40000000" - file-name: "vals" bugid: ['1387'] tags: ["tsan"] isa: instructions: - sig: shr2 v:in:i32 acc: inout:i32 prefix: bit format: [pref_op_v_8] code-template: | # ldai %s movi v0, %s shr2 v0 movi v0, %s jne v0, set_failure ldai 0 jmp fall_through set_failure: ldai 1 fall_through: description: Check shr2 with various values. cases: - values: - "0x5A8D97D0" - "0xDA783975" - "0x2D4" - values: - "0x4A37BE" - "0x257556A" - "0x128D" - values: - "0xD631242" - "0x47A1179D" - "0x0" - values: - "0x153C1D64" - "0xB3FD21B1" - "0xA9E" - values: - "0x5499AF7B" - "0x3939DE4C" - "0x5499A" - values: - "0xB7C3B77F" - "0xCCA63ED3" - "0x16F8" - values: - "0x90F9BD15" - "0xA8A9ADC" - "0x9" - values: - "0x226BA4EA" - "0x21A3F177" - "0x44" - values: - "0x4A295B4C" - "0x62F1D4C9" - "0x2514AD" - values: - "0xCA310014" - "0xC9A571C8" - "0xCA3100" - file-name: "vals_mod32_1" bugid: ['1324'] tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] isa: instructions: - sig: shr2 v:in:i32 acc: inout:i32 prefix: bit format: [pref_op_v_8] code-template: | # ldai.64 %s movi.64 v0, %s shr2 v0 movi.64 v0, %s cmp.64 v0 description: Check shr2 with incorrect accumulator and register types. cases: - values: - "0x17FFFFFFF" - "0x1" - "0x000000003FFFFFFF" - values: - "0x77777777FFFFFFFF" - "0x1111111180000000" - "0xFFFFFFFFFFFFFFFF" - values: - "0x180000000" - "0x180000000" - "0xFFFFFFFF80000000" - file-name: "regs" isa: instructions: - sig: shr2 v:in:i32 acc: inout:i32 prefix: bit format: [pref_op_v_8] runner-options: ['compile-only'] code-template: | # shr2 %s check-type: none description: Check shr2 with various register numbers. cases: - values: - "v255" - values: - "v256" runner-options: ['compile-failure'] - file-name: "type" bugid: ["964", "966"] tags: ["verifier"] isa: verification: - acc_type - v1_type runner-options: ['verifier-failure', 'verifier-config'] header-template: [] code-template: | .record T {} .function i32 main() { %s *s shr2 v0 check-type: exit-positive description: Check 'shr2' with incorrect accumulator and/or register types. cases: - values: - ldai 0 id: acc_ok - values: - ldai.64 0 - values: - fldai 0 bugid: ['7315'] - values: - fldai.64 0 - values: - lda.null - values: - | # movi v1, 0 newarr v1, v1, i32[] lda.obj v1 - values: - lda.str "0" - values: - lda.type T - values: - | # newobj v1, T lda.obj v1 template-cases: - values: - movi v0, 0 exclude: [acc_ok] - values: - movi.64 v0, 0 - values: - fmovi v0, 0 bugid: ['7315'] - values: - fmovi.64 v0, 0 - values: - mov.null v0 - values: - | # movi v0, 0 newarr v0, v0, i32[] - values: - | # lda.str "0" sta.obj v0 - values: - | # lda.type T sta.obj v0 - values: - newobj v0, T - file-name: uninitialized_regs isa: instructions: - sig: shr2 v:in:i32 acc: inout:i32 prefix: bit format: [pref_op_v_8] description: Check 'shr2' with uninitialized registers. tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] code-template: | # %s *s shr2 *s check-type: exit-positive template-cases: - values: - '' - values: - ldai 0 exclude: [init] cases: - values: - '' - v0 - values: - movi v1, 0 - v1 id: init - values: - '' - v8 - values: - '' - v15 - values: - movi v15, 0 - v15 id: init