# 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: ashri isa: title: Two address binary operation with immediate on accumulator description: > Perform specified binary operation on accumulator and immediate and store result into accumulator. Immediate is sign extended to operand size. exceptions: - x_none commands: - file-name: op_imm_8_zero isa: instructions: - sig: ashri imm:i32 acc: inout:i32 format: [op_imm_8] code-template: | # ldai 0 ashri %s movi v0, 0 jne v0, set_failure ldai 0 return set_failure: ldai 1 return check-type: none description: Check `ashri` with zero and various values. cases: - values: ["0"] - values: ["1"] - values: ["-1"] - values: ["0xF"] - values: ["-0xF"] - values: ["0x7F"] - values: ["-0x7F"] - values: ["0x80"] - values: ["-0x80"] - values: ["0xFF"] - values: ["-0xFF"] - file-name: op_imm_8_pone isa: instructions: - sig: ashri imm:i32 acc: inout:i32 format: [op_imm_8] code-template: | # ldai 1 ashri %s movi v0, %s jne v0, set_failure ldai 0 return set_failure: ldai 1 return check-type: none description: Check `ashri` with +1 and various values. cases: - values: ["0", "0x1"] - values: ["1", "0x0"] - values: ["-1", "0x0"] - values: ["0xF", "0x0"] - values: ["-0xF", "0x0"] - values: ["0x7F", "0x0"] - values: ["-0x7F", "0x0"] - values: ["0x80", "0x1"] - values: ["-0x80", "0x1"] - values: ["0xFF", "0x0"] - values: ["-0xFF", "0x0"] - file-name: op_imm_8_none isa: instructions: - sig: ashri imm:i32 acc: inout:i32 format: [op_imm_8] code-template: | # ldai -1 ashri %s movi v0, 0xFFFFFFFF jne v0, set_failure ldai 0 return set_failure: ldai 1 return check-type: none description: Check `ashri` with -1 and various values. cases: - values: ["0"] - values: ["1"] - values: ["-1"] - values: ["0xF"] - values: ["-0xF"] - values: ["0x7F"] - values: ["-0x7F"] - values: ["0x80"] - values: ["-0x80"] - values: ["0xFF"] - values: ["-0xFF"] - file-name: op_imm_8_pmax isa: instructions: - sig: ashri imm:i32 acc: inout:i32 format: [op_imm_8] code-template: | # ldai 0x7FFFFFFF ashri %s movi v0, %s jne v0, set_failure ldai 0 return set_failure: ldai 1 return check-type: none description: Check `ashri` with +max and various values. cases: - values: ["0", "0x7FFFFFFF"] - values: ["1", "0x3FFFFFFF"] - values: ["-1", "0x0"] - values: ["0xF", "0xFFFF"] - values: ["-0xF", "0x3FFF"] - values: ["0x7F", "0x0"] - values: ["-0x7F", "0x3FFFFFFF"] - values: ["0x80", "0x7FFFFFFF"] - values: ["-0x80", "0x7FFFFFFF"] - values: ["0xFF", "0x0"] - values: ["-0xFF", "0x3FFFFFFF"] - file-name: op_imm_8_nmax isa: instructions: - sig: ashri imm:i32 acc: inout:i32 format: [op_imm_8] code-template: | # ldai -0x80000000 ashri %s movi v0, %s jne v0, set_failure ldai 0 return set_failure: ldai 1 return check-type: none description: Check `ashri` with -max and various values. cases: - values: ["0", "0x80000000"] - values: ["1", "0xC0000000"] - values: ["-1", "0xFFFFFFFF"] - values: ["0xF", "0xFFFF0000"] - values: ["-0xF", "0xFFFFC000"] - values: ["0x7F", "0xFFFFFFFF"] - values: ["-0x7F", "0xC0000000"] - values: ["0x80", "0x80000000"] - values: ["-0x80", "0x80000000"] - values: ["0xFF", "0xFFFFFFFF"] - values: ["-0xFF", "0xC0000000"] - file-name: vals isa: instructions: - sig: ashri imm:i32 acc: inout:i32 format: [op_imm_8] code-template: | # ldai %s ashri %s movi v0, %s jne v0, set_failure ldai 0 return set_failure: ldai 1 return check-type: none description: Check `ashri` with various values. tags: ['tsan'] cases: - values: ["0x47BC623", "0xF0", "0x47B"] - values: ["0x98FF55FA", "0x37", "0xFFFFFF31"] - values: ["0x4BFD9885", "0x74", "0x4BF"] - values: ["0xB2FC1EB6", "0x01", "0xD97E0F5B"] - values: ["0x7E2C4D16", "0xC6", "0x1F8B134"] - values: ["0xDEE4E62E", "0x01", "0xEF727317"] - values: ["0x1BE3708A", "0x8D", "0xDF1B"] - values: ["0x15C646C2", "0x2F", "0x2B8C"] - values: ["0xC86F8B23", "0xDF", "0xFFFFFFFF"] - values: ["0x978A9490", "0xE9", "0xFFCBC54A"] - file-name: type isa: verification: - acc_type tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] header-template: [] code-template: | # .record panda.Object .function i32 main() { %s ashri 0 check-type: exit-positive description: Check 'ashri' with incorrect acc type. cases: - values: [ldai.64 0] - values: [fldai 0] bugid: ['7315'] - values: [fldai.64 0] - values: [lda.null] - values: [lda.type panda.Object] - values: ['lda.type i32[]'] - values: [lda.str ""] - values: - | # newobj v0, panda.Object lda.obj v0 - values: - | # movi v0, 10 newarr v0, v0, i32[] lda.obj v0 - file-name: uninitialized_acc isa: instructions: - sig: ashri imm:i32 acc: inout:i32 format: [op_imm_8] description: Check 'ashri' with uninitialized accumulator. tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] code-template: | # ashri 0 check-type: exit-positive