# 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: lda.64 isa: title: Load accumulator from register description: Moves register content into an accumulator. exceptions: - x_none commands: - file-name: op_vd_8 description: Check lda.64 moves register content into an accumulator. isa: instructions: - sig: lda.64 v:in:b64 acc: out:b64 format: [op_v_8] code-template: | # %s ldai 0 return err: ldai 1 return check-type: none cases: - values: - "#{[ '0', '1', '0xF', '0xFF', '0xFFF', '0xFFFF', '0xFFFFF', '0xFFFFFF', '0xFFFFFFF', '0xFFFFFFFF', '0xFFFFFFFFF', '0xFFFFFFFFFF', '0xFFFFFFFFFFF', '0xFFFFFFFFFFFF', '0xFFFFFFFFFFFFF', '0xFFFFFFFFFFFFFF', '0xFFFFFFFFFFFFFFF', '0xFFFFFFFFFFFFFFFF', '0x7F', '0x7FF', '0x7FFF', '0x7FFFF', '0x7FFFFF', '0x7FFFFFF', '0x7FFFFFFF', '0x7FFFFFFFF', '0x7FFFFFFFFF', '0x7FFFFFFFFFF', '0x7FFFFFFFFFFF', '0x7FFFFFFFFFFFF', '0x7FFFFFFFFFFFFF', '0x7FFFFFFFFFFFFFF', '0x7FFFFFFFFFFFFFFF', '-1', '-0xF', '-0xFF', '-0xFFF', '-0xFFFF', '-0xFFFFF', '-0xFFFFFF', '-0xFFFFFFF', '-0xFFFFFFFF', '-0xFFFFFFFFF', '-0xFFFFFFFFFF', '-0xFFFFFFFFFFF', '-0xFFFFFFFFFFFF', '-0xFFFFFFFFFFFFF', '-0xFFFFFFFFFFFFFF', '-0xFFFFFFFFFFFFFFF', '-0xFFFFFFFFFFFFFFFF', '-0x7F', '-0x7FF', '-0x7FFF', '-0x7FFFF', '-0x7FFFFF', '-0x7FFFFFF', '-0x7FFFFFFF', '-0x7FFFFFFFF', '-0x7FFFFFFFFF', '-0x7FFFFFFFFFF', '-0x7FFFFFFFFFFF', '-0x7FFFFFFFFFFFF', '-0x7FFFFFFFFFFFFF', '-0x7FFFFFFFFFFFFFF', '-0x7FFFFFFFFFFFFFFF' ].map do |s| \" movi.64 v0, #{s}\\n lda.64 v0\\n cmp.64 v0\\n jnez err\\n\" end .join}" - file-name: reg isa: instructions: - sig: lda.64 v:in:b64 acc: out:b64 format: [op_v_8] check-type: none code-template: | # %s ldai 0 return err: ldai 1 return description: Check 'lda.64' with valid register numbers. cases: - values: - "#{[*0..255].map do |i| \" movi.64 v#{i}, 0xDEADBEEFBADC0FFE\\n lda.64 v#{i}\\n cmp.64 v#{i}\\n jnez err\\n\" end .join}" - file-name: reg_err isa: instructions: - sig: lda.64 v:in:b64 acc: out:b64 format: [op_v_8] check-type: none runner-options: [compile-failure] code-template: | # lda.64 %s ldai 0 return description: Check 'lda.64' with some invalid register numbers. cases: - values: - v256 - values: - a0 - values: - v32565 - values: - 0 - file-name: type isa: verification: - v1_type description: Check lda.64 with incorrect source register type. Accumulator type is not checked. runner-options: ['verifier-failure', 'verifier-config'] tags: ['verifier'] header-template: [] code-template: | # .record A {} .record B {} .record panda.String .record panda.Object .function i32 main() { *s %s lda.64 v1 ldai 0 check-type: no-check template-cases: - values: - | # lda.type B - values: - | # lda.type B[] - values: - | # lda.type panda.String - values: - | # lda.str "string" - values: - | # lda.type panda.Object - values: - | # movi v0, 10 newarr v0, v0, i32[] lda.obj v0 - values: - lda.null - values: - ldai 0 - values: - ldai.64 0 - values: - fldai.64 0 cases: - values: - | # lda.type A sta.obj v1 - values: - | # lda.type A[] sta.obj v1 - values: - | # lda.type panda.String sta.obj v1 - values: - | # lda.str "string" sta.obj v1 - values: - | # lda.type panda.Object sta.obj v1 - values: - | # movi v1, 10 newarr v1, v1, f64[] - values: - mov.null v1 - values: - movi v1, 0 - values: - fmovi v1, 0 bugid: ['6094'] - file-name: uninitialized_regs isa: instructions: - sig: lda.64 v:in:b64 acc: out:b64 format: [op_v_8] description: Check lda.64 with uninitialized registers. tags: ['verifier'] runner-options: ['verifier-failure', 'verifier-config'] header-template: [] code-template: | # .function i32 main() { lda.64 %s ldai 0 check-type: no-check cases: - values: - v0 - values: - v8 - values: - v15 - values: - v255