# 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: 'sta' isa: title: Store accumulator description: Moves accumulator content into a register. exceptions: - x_none commands: - file-name: 'op_vd_8' description: Check sta moves accumulator content into a register. isa: instructions: - sig: sta v:out:b32 acc: in:b32 format: [op_v_8] code-template: | # %s ldai 0 return err: ldai 1 return check-type: none tags: ['tsan'] cases: - values: - "#{[ '0', '1', '0xF', '0xFF', '0xFFF', '0xFFFF', '0xFFFFF', '0xFFFFFF', '0xFFFFFFF', '0xFFFFFFFF', '0x7F', '0x7FF', '0x7FFF', '0x7FFFF', '0x7FFFFF', '0x7FFFFFF', '0x7FFFFFFF', '-1', '-0xF', '-0xFF', '-0xFFF', '-0xFFFF', '-0xFFFFF', '-0xFFFFFF', '-0xFFFFFFF', '-0xFFFFFFFF', '-0x7F', '-0x7FF', '-0x7FFF', '-0x7FFFF', '-0x7FFFFF', '-0x7FFFFFF', '-0x7FFFFFFF' ].map do |s| \" ldai #{s}\\n sta v0\\n jne v0, err\\n\" end .join}" - file-name: 'reg' description: Check sta with various register numbers. isa: instructions: - sig: sta v:out:b32 acc: in:b32 format: [op_v_8] code-template: | # ldai 0xDEADBEEF sta %s jne %s, set_failure ldai 0 return set_failure: ldai 1 return check-type: none cases: - values: [v0, v0] - values: [v1, v1] - values: [v7, v7] - values: [v8, v8] - values: [v15, v15] - values: [v16, v16] - values: [v127, v127] - values: [v128, v128] - values: [v255, v255] - values: [v256, v255] runner-options: [compile-failure] description: Check sta with incorrect register numbers. - values: [a0, v255] runner-options: [compile-failure] description: Check sta with incorrect register numbers. - values: [0, v255] runner-options: [compile-failure] description: Check sta with incorrect register numbers. - file-name: 'type' description: Check 'sta' with incorrect accumulator type. Register type is not checked. isa: verification: - 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() { ##- v1 initialization with different types *s ##- Accumulator initialization with incorrect types %s sta v1 check-type: exit-positive template-cases: - values: - ldai.64 0 - values: - fldai.64 0 - values: - | # lda.type B - values: - | # lda.type B[] - values: - | # lda.type panda.String - values: - | # lda.str "string" - values: - | # movi v0, 10 newarr v0, v0, i32[] lda.obj v0 - values: - lda.null cases: - values: - movi v1, 0 - values: - movi.64 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 description: Check 'sta' with uninitialized accumulator. Destination register is not checked. isa: instructions: - sig: sta v:out:b32 acc: in:b32 format: [op_v_8] tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] header-template: [] code-template: | # .function i32 main() { %s sta %s check-type: exit-positive cases: - values: - '' - v0 - values: - movi v0, 0 - v0 - values: - '' - v15 - values: - 'movi.64 v15, 0' - v15 - values: - '' - v128 - values: - 'fmovi.64 v128, 0' - v128 - values: - '' - v255 - values: - 'mov.null v255' - v255 - file-name: 'err' description: Check sta.64 with incorrect value. isa: instructions: - sig: sta v:out:b32 acc: in:b32 format: [op_v_8] runner-options: [compile-failure] code-template: | # Check sta with wrong arguments %s check-type: exit-positive cases: - values: - sta 1 - values: - sta 1.1 - values: - sta a0 - values: - sta ""