1b8021494Sopenharmony_ci// Copyright 2016, VIXL authors 2b8021494Sopenharmony_ci// All rights reserved. 3b8021494Sopenharmony_ci// 4b8021494Sopenharmony_ci// Redistribution and use in source and binary forms, with or without 5b8021494Sopenharmony_ci// modification, are permitted provided that the following conditions are met: 6b8021494Sopenharmony_ci// 7b8021494Sopenharmony_ci// * Redistributions of source code must retain the above copyright notice, 8b8021494Sopenharmony_ci// this list of conditions and the following disclaimer. 9b8021494Sopenharmony_ci// * Redistributions in binary form must reproduce the above copyright notice, 10b8021494Sopenharmony_ci// this list of conditions and the following disclaimer in the documentation 11b8021494Sopenharmony_ci// and/or other materials provided with the distribution. 12b8021494Sopenharmony_ci// * Neither the name of ARM Limited nor the names of its contributors may be 13b8021494Sopenharmony_ci// used to endorse or promote products derived from this software without 14b8021494Sopenharmony_ci// specific prior written permission. 15b8021494Sopenharmony_ci// 16b8021494Sopenharmony_ci// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND 17b8021494Sopenharmony_ci// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18b8021494Sopenharmony_ci// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19b8021494Sopenharmony_ci// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 20b8021494Sopenharmony_ci// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21b8021494Sopenharmony_ci// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22b8021494Sopenharmony_ci// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23b8021494Sopenharmony_ci// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24b8021494Sopenharmony_ci// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25b8021494Sopenharmony_ci// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26b8021494Sopenharmony_ci 27b8021494Sopenharmony_ci// Test description for instructions of the following forms: 28b8021494Sopenharmony_ci// MNEMONIC{<c>}{<q>} <Rd>, <Rm> 29b8021494Sopenharmony_ci// MNEMONIC{<c>}{<q>} <Rn>, <Rm> {, <shift> #<amount> } 30b8021494Sopenharmony_ci// MNEMONIC{<c>}{<q>} {<Rd>}, <Rm> {, ROR #<amount> } 31b8021494Sopenharmony_ci// 32b8021494Sopenharmony_ci// Note that this test only covers the cases where the optional shift 33b8021494Sopenharmony_ci// operand is not provided. The shift operands are tested in 34b8021494Sopenharmony_ci// "cond-rd-operand-rn-shift-amount-*-t32.json". 35b8021494Sopenharmony_ci 36b8021494Sopenharmony_ci{ 37b8021494Sopenharmony_ci "mnemonics" : [ 38b8021494Sopenharmony_ci "Cmn", // CMN{<c>}{<q>} <Rn>, <Rm> ; T1 39b8021494Sopenharmony_ci // CMN{<c>}{<q>} <Rn>, <Rm> {, <shift> #<amount> } ; T2 40b8021494Sopenharmony_ci "Cmp", // CMP{<c>}{<q>} <Rn>, <Rm> ; T1 41b8021494Sopenharmony_ci // CMP{<c>}{<q>} <Rn>, <Rm> ; T2 42b8021494Sopenharmony_ci "Mov", // MOV{<c>}{<q>} <Rd>, <Rm> ; T1 43b8021494Sopenharmony_ci // MOV<c>{<q>} <Rd>, <Rm> {, <shift> #<amount> } ; T2 44b8021494Sopenharmony_ci // MOV{<c>}{<q>} <Rd>, <Rm> {, <shift> #<amount> } ; T3 45b8021494Sopenharmony_ci "Movs", // MOVS{<q>} <Rd>, <Rm> {, <shift> #<amount> } ; T2 46b8021494Sopenharmony_ci // MOVS{<c>}{<q>} <Rd>, <Rm> {, <shift> #<amount> } ; T3 47b8021494Sopenharmony_ci "Mvn", // MVN<c>{<q>} <Rd>, <Rm> ; T1 48b8021494Sopenharmony_ci // MVN{<c>}{<q>} <Rd>, <Rm> {, <shift> #<amount> } ; T2 49b8021494Sopenharmony_ci "Mvns", // MVNS{<q>} <Rd>, <Rm> ; T1 50b8021494Sopenharmony_ci // MVNS{<c>}{<q>} <Rd>, <Rm> {, <shift> #<amount> } ; T2 51b8021494Sopenharmony_ci "Teq", // TEQ{<c>}{<q>} <Rn>, <Rm> {, <shift> #<amount> } ; T1 52b8021494Sopenharmony_ci "Tst", // TST{<c>}{<q>} <Rn>, <Rm> ; T1 53b8021494Sopenharmony_ci 54b8021494Sopenharmony_ci "Sxtb", // SXTB{<c>}{<q>} {<Rd>}, <Rm> ; T1 55b8021494Sopenharmony_ci // SXTB{<c>}{<q>} {<Rd>}, <Rm> {, ROR #<amount> } ; T2 56b8021494Sopenharmony_ci "Sxtb16", // SXTB16{<c>}{<q>} {<Rd>}, <Rm> {, ROR #<amount> } ; T1 57b8021494Sopenharmony_ci "Sxth", // SXTH{<c>}{<q>} {<Rd>}, <Rm> ; T1 58b8021494Sopenharmony_ci // SXTH{<c>}{<q>} {<Rd>}, <Rm> {, ROR #<amount> } ; T2 59b8021494Sopenharmony_ci "Uxtb", // UXTB{<c>}{<q>} {<Rd>}, <Rm> ; T1 60b8021494Sopenharmony_ci // UXTB{<c>}{<q>} {<Rd>}, <Rm> {, ROR #<amount> } ; T2 61b8021494Sopenharmony_ci "Uxtb16", // UXTB16{<c>}{<q>} {<Rd>}, <Rm> {, ROR #<amount> } ; T1 62b8021494Sopenharmony_ci "Uxth" // UXTH{<c>}{<q>} {<Rd>}, <Rm> ; T1 63b8021494Sopenharmony_ci // UXTH{<c>}{<q>} {<Rd>}, <Rm> {, ROR #<amount> } ; T2 64b8021494Sopenharmony_ci ], 65b8021494Sopenharmony_ci "description" : { 66b8021494Sopenharmony_ci "operands": [ 67b8021494Sopenharmony_ci { 68b8021494Sopenharmony_ci "name": "cond", 69b8021494Sopenharmony_ci "type": "Condition" 70b8021494Sopenharmony_ci }, 71b8021494Sopenharmony_ci { 72b8021494Sopenharmony_ci "name": "rd", 73b8021494Sopenharmony_ci "type": "AllRegistersButPC" 74b8021494Sopenharmony_ci }, 75b8021494Sopenharmony_ci { 76b8021494Sopenharmony_ci "name": "op", 77b8021494Sopenharmony_ci "wrapper": "Operand", 78b8021494Sopenharmony_ci "operands": [ 79b8021494Sopenharmony_ci { 80b8021494Sopenharmony_ci "name": "rn", 81b8021494Sopenharmony_ci "type": "AllRegistersButPC" 82b8021494Sopenharmony_ci } 83b8021494Sopenharmony_ci ] 84b8021494Sopenharmony_ci } 85b8021494Sopenharmony_ci ], 86b8021494Sopenharmony_ci "inputs": [ 87b8021494Sopenharmony_ci { 88b8021494Sopenharmony_ci "name": "apsr", 89b8021494Sopenharmony_ci "type": "NZCV" 90b8021494Sopenharmony_ci }, 91b8021494Sopenharmony_ci { 92b8021494Sopenharmony_ci "name": "rd", 93b8021494Sopenharmony_ci "type": "Register" 94b8021494Sopenharmony_ci }, 95b8021494Sopenharmony_ci { 96b8021494Sopenharmony_ci "name": "rn", 97b8021494Sopenharmony_ci "type": "Register" 98b8021494Sopenharmony_ci } 99b8021494Sopenharmony_ci ] 100b8021494Sopenharmony_ci }, 101b8021494Sopenharmony_ci "test-files": [ 102b8021494Sopenharmony_ci { 103b8021494Sopenharmony_ci "type": "assembler", 104b8021494Sopenharmony_ci "test-cases": [ 105b8021494Sopenharmony_ci { 106b8021494Sopenharmony_ci "name": "Unconditional", 107b8021494Sopenharmony_ci "operands": [ 108b8021494Sopenharmony_ci "cond", "rd", "rn" 109b8021494Sopenharmony_ci ], 110b8021494Sopenharmony_ci "operand-filter": "cond == 'al'" 111b8021494Sopenharmony_ci } 112b8021494Sopenharmony_ci ] 113b8021494Sopenharmony_ci }, 114b8021494Sopenharmony_ci // Test instructions in an IT block with no restrictions on registers. 115b8021494Sopenharmony_ci { 116b8021494Sopenharmony_ci "name": "in-it-block", 117b8021494Sopenharmony_ci "type": "assembler", 118b8021494Sopenharmony_ci "mnemonics" : [ 119b8021494Sopenharmony_ci "Cmp", // CMP{<c>}{<q>} <Rn>, <Rm> ; T1 120b8021494Sopenharmony_ci "Mov" // MOV{<c>}{<q>} <Rd>, <Rm> ; T1 121b8021494Sopenharmony_ci ], 122b8021494Sopenharmony_ci "test-cases": [ 123b8021494Sopenharmony_ci { 124b8021494Sopenharmony_ci "name": "InITBlock", 125b8021494Sopenharmony_ci "operands": [ 126b8021494Sopenharmony_ci "cond", "rd", "rn" 127b8021494Sopenharmony_ci ], 128b8021494Sopenharmony_ci // Generate an extra IT instruction. 129b8021494Sopenharmony_ci "in-it-block": "{cond}", 130b8021494Sopenharmony_ci "operand-filter": "cond != 'al'" 131b8021494Sopenharmony_ci } 132b8021494Sopenharmony_ci ] 133b8021494Sopenharmony_ci }, 134b8021494Sopenharmony_ci // Test instructions in an IT block where registers have to be from r0 to r7. 135b8021494Sopenharmony_ci { 136b8021494Sopenharmony_ci "name": "low-registers-in-it-block", 137b8021494Sopenharmony_ci "type": "assembler", 138b8021494Sopenharmony_ci "mnemonics" : [ 139b8021494Sopenharmony_ci "Cmn", // CMN{<c>}{<q>} <Rn>, <Rm> ; T1 140b8021494Sopenharmony_ci "Tst" // TST{<c>}{<q>} <Rn>, <Rm> ; T1 141b8021494Sopenharmony_ci ], 142b8021494Sopenharmony_ci "test-cases": [ 143b8021494Sopenharmony_ci { 144b8021494Sopenharmony_ci "name": "InITBlock", 145b8021494Sopenharmony_ci "operands": [ 146b8021494Sopenharmony_ci "cond", "rd", "rn" 147b8021494Sopenharmony_ci ], 148b8021494Sopenharmony_ci // Generate an extra IT instruction. 149b8021494Sopenharmony_ci "in-it-block": "{cond}", 150b8021494Sopenharmony_ci "operand-filter": "cond != 'al' and register_is_low(rd) and register_is_low(rn)" 151b8021494Sopenharmony_ci } 152b8021494Sopenharmony_ci ] 153b8021494Sopenharmony_ci }, 154b8021494Sopenharmony_ci // Special case for MVN in an IT block, both register operands 155b8021494Sopenharmony_ci // need to be identical as well as from r0 to r7. 156b8021494Sopenharmony_ci { 157b8021494Sopenharmony_ci "name": "identical-low-registers-in-it-block", 158b8021494Sopenharmony_ci "type": "assembler", 159b8021494Sopenharmony_ci "mnemonics" : [ 160b8021494Sopenharmony_ci "Mvn" // MVN<c>{<q>} <Rd>, <Rm> ; T1 161b8021494Sopenharmony_ci ], 162b8021494Sopenharmony_ci "test-cases": [ 163b8021494Sopenharmony_ci { 164b8021494Sopenharmony_ci "name": "InITBlock", 165b8021494Sopenharmony_ci "operands": [ 166b8021494Sopenharmony_ci "cond", "rd", "rn" 167b8021494Sopenharmony_ci ], 168b8021494Sopenharmony_ci // Generate an extra IT instruction. 169b8021494Sopenharmony_ci "in-it-block": "{cond}", 170b8021494Sopenharmony_ci "operand-filter": "cond != 'al' and rd == rn and register_is_low(rd)" 171b8021494Sopenharmony_ci } 172b8021494Sopenharmony_ci ] 173b8021494Sopenharmony_ci }, 174b8021494Sopenharmony_ci { 175b8021494Sopenharmony_ci "type": "simulator", 176b8021494Sopenharmony_ci "test-cases": [ 177b8021494Sopenharmony_ci { 178b8021494Sopenharmony_ci "name": "Condition", 179b8021494Sopenharmony_ci "operands": [ 180b8021494Sopenharmony_ci "cond" 181b8021494Sopenharmony_ci ], 182b8021494Sopenharmony_ci "inputs": [ 183b8021494Sopenharmony_ci "apsr" 184b8021494Sopenharmony_ci ] 185b8021494Sopenharmony_ci }, 186b8021494Sopenharmony_ci // Test combinations of registers values with rd == rn. 187b8021494Sopenharmony_ci { 188b8021494Sopenharmony_ci "name": "RdIsRn", 189b8021494Sopenharmony_ci "operands": [ 190b8021494Sopenharmony_ci "rd", "rn" 191b8021494Sopenharmony_ci ], 192b8021494Sopenharmony_ci "inputs": [ 193b8021494Sopenharmony_ci "rd", "rn" 194b8021494Sopenharmony_ci ], 195b8021494Sopenharmony_ci "operand-filter": "rd == rn", 196b8021494Sopenharmony_ci "input-filter": "rd == rn" 197b8021494Sopenharmony_ci }, 198b8021494Sopenharmony_ci // Test combinations of registers values. 199b8021494Sopenharmony_ci { 200b8021494Sopenharmony_ci "name": "RdIsNotRn", 201b8021494Sopenharmony_ci "operands": [ 202b8021494Sopenharmony_ci "rd", "rn" 203b8021494Sopenharmony_ci ], 204b8021494Sopenharmony_ci "inputs": [ 205b8021494Sopenharmony_ci "rd", "rn" 206b8021494Sopenharmony_ci ], 207b8021494Sopenharmony_ci "operand-filter": "rd != rn", 208b8021494Sopenharmony_ci "operand-limit": 10, 209b8021494Sopenharmony_ci "input-limit": 200 210b8021494Sopenharmony_ci } 211b8021494Sopenharmony_ci ] 212b8021494Sopenharmony_ci } 213b8021494Sopenharmony_ci ] 214b8021494Sopenharmony_ci} 215