1 1.1 christos /* Tests instructions l.ror and l.rori. 2 1.1 christos 3 1.1.1.2 christos Copyright (C) 2017-2024 Free Software Foundation, Inc. 4 1.1 christos 5 1.1 christos This program is free software; you can redistribute it and/or modify 6 1.1 christos it under the terms of the GNU General Public License as published by 7 1.1 christos the Free Software Foundation; either version 3 of the License, or 8 1.1 christos (at your option) any later version. 9 1.1 christos 10 1.1 christos This program is distributed in the hope that it will be useful, 11 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 12 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 1.1 christos GNU General Public License for more details. 14 1.1 christos 15 1.1 christos You should have received a copy of the GNU General Public License 16 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 17 1.1 christos 18 1.1 christos # mach: or1k 19 1.1 christos # output: report(0xb38f0f83);\n 20 1.1 christos # output: report(0x00000000);\n 21 1.1 christos # output: report(0xb38f0f83);\n 22 1.1 christos # output: \n 23 1.1 christos # output: report(0xb38f0f83);\n 24 1.1 christos # output: report(0x00000001);\n 25 1.1 christos # output: report(0xd9c787c1);\n 26 1.1 christos # output: \n 27 1.1 christos # output: report(0xb38f0f83);\n 28 1.1 christos # output: report(0x00000004);\n 29 1.1 christos # output: report(0x3b38f0f8);\n 30 1.1 christos # output: \n 31 1.1 christos # output: report(0xb38f0f83);\n 32 1.1 christos # output: report(0x00000010);\n 33 1.1 christos # output: report(0x0f83b38f);\n 34 1.1 christos # output: \n 35 1.1 christos # output: report(0xb38f0f83);\n 36 1.1 christos # output: report(0x0000001f);\n 37 1.1 christos # output: report(0x671e1f07);\n 38 1.1 christos # output: \n 39 1.1 christos # output: report(0xb38f0f83);\n 40 1.1 christos # output: report(0x00000021);\n 41 1.1 christos # output: report(0xd9c787c1);\n 42 1.1 christos # output: \n 43 1.1 christos # output: report(0xb38f0f83);\n 44 1.1 christos # output: report(0x00002224);\n 45 1.1 christos # output: report(0x3b38f0f8);\n 46 1.1 christos # output: \n 47 1.1 christos # output: report(0xb38f0f83);\n 48 1.1 christos # output: report(0x00f789f0);\n 49 1.1 christos # output: report(0x0f83b38f);\n 50 1.1 christos # output: \n 51 1.1 christos # output: report(0xb38f0f83);\n 52 1.1 christos # output: report(0xffffffff);\n 53 1.1 christos # output: report(0x671e1f07);\n 54 1.1 christos # output: \n 55 1.1 christos # output: report(0xb38f0f83);\n 56 1.1 christos # output: report(0x00000000);\n 57 1.1 christos # output: report(0xb38f0f83);\n 58 1.1 christos # output: \n 59 1.1 christos # output: report(0xb38f0f83);\n 60 1.1 christos # output: report(0x00000001);\n 61 1.1 christos # output: report(0xd9c787c1);\n 62 1.1 christos # output: \n 63 1.1 christos # output: report(0xb38f0f83);\n 64 1.1 christos # output: report(0x00000004);\n 65 1.1 christos # output: report(0x3b38f0f8);\n 66 1.1 christos # output: \n 67 1.1 christos # output: report(0xb38f0f83);\n 68 1.1 christos # output: report(0x00000010);\n 69 1.1 christos # output: report(0x0f83b38f);\n 70 1.1 christos # output: \n 71 1.1 christos # output: report(0xb38f0f83);\n 72 1.1 christos # output: report(0x0000001f);\n 73 1.1 christos # output: report(0x671e1f07);\n 74 1.1 christos # output: \n 75 1.1 christos # output: report(0xb38f0f83);\n 76 1.1 christos # output: report(0x00000021);\n 77 1.1 christos # output: report(0xd9c787c1);\n 78 1.1 christos # output: \n 79 1.1 christos # output: report(0xb38f0f83);\n 80 1.1 christos # output: report(0x00000024);\n 81 1.1 christos # output: report(0x3b38f0f8);\n 82 1.1 christos # output: \n 83 1.1 christos # output: report(0xb38f0f83);\n 84 1.1 christos # output: report(0x00000030);\n 85 1.1 christos # output: report(0x0f83b38f);\n 86 1.1 christos # output: \n 87 1.1 christos # output: report(0xb38f0f83);\n 88 1.1 christos # output: report(0x0000003f);\n 89 1.1 christos # output: report(0x671e1f07);\n 90 1.1 christos # output: \n 91 1.1 christos # output: exit(0)\n 92 1.1 christos 93 1.1 christos #include "or1k-asm-test-env.h" 94 1.1 christos 95 1.1 christos .macro TEST_ROR op1, op2, res 96 1.1 christos /* Note that 'res' is not used here. We could stop using the 97 1.1 christos .TestResults file and use 'res' here instead. */ 98 1.1 christos LOAD_IMMEDIATE r5, \op1 99 1.1 christos LOAD_IMMEDIATE r6, \op2 100 1.1 christos REPORT_REG_TO_CONSOLE r5 101 1.1 christos REPORT_REG_TO_CONSOLE r6 102 1.1 christos l.ror r4, r5, r6 103 1.1 christos REPORT_REG_TO_CONSOLE r4 104 1.1 christos PRINT_NEWLINE_TO_CONSOLE 105 1.1 christos .endm 106 1.1 christos 107 1.1 christos .macro TEST_RORI op1, op2, res 108 1.1 christos /* Note that 'res' is not used here. We could stop using the 109 1.1 christos .TestResults file and use 'res' here instead. */ 110 1.1 christos LOAD_IMMEDIATE r5, \op1 111 1.1 christos REPORT_REG_TO_CONSOLE r5 112 1.1 christos REPORT_IMMEDIATE_TO_CONSOLE \op2 113 1.1 christos l.rori r4, r5, \op2 114 1.1 christos REPORT_REG_TO_CONSOLE r4 115 1.1 christos PRINT_NEWLINE_TO_CONSOLE 116 1.1 christos .endm 117 1.1 christos 118 1.1 christos STANDARD_TEST_ENVIRONMENT 119 1.1 christos 120 1.1 christos .section .text 121 1.1 christos start_tests: 122 1.1 christos PUSH LINK_REGISTER_R9 123 1.1 christos 124 1.1 christos /* Test the l.ror instruction. */ 125 1.1 christos 126 1.1 christos /* Rotate by zero */ 127 1.1 christos TEST_ROR 0xb38f0f83, 0x00000000, 0xb38f0f83 128 1.1 christos 129 1.1 christos /* Rotate by amounts in the 1 - 31 range. */ 130 1.1 christos TEST_ROR 0xb38f0f83, 0x00000001, 0xd9c787c1 131 1.1 christos TEST_ROR 0xb38f0f83, 0x00000004, 0x3b38f0f8 132 1.1 christos TEST_ROR 0xb38f0f83, 0x00000010, 0x0f83b38f 133 1.1 christos TEST_ROR 0xb38f0f83, 0x0000001f, 0x671e1f07 134 1.1 christos 135 1.1 christos /* Rotate by larger amounts - should be masked. */ 136 1.1 christos TEST_ROR 0xb38f0f83, 0x00000021, 0xd9c787c1 137 1.1 christos TEST_ROR 0xb38f0f83, 0x00002224, 0x3b38f0f8 138 1.1 christos TEST_ROR 0xb38f0f83, 0x00f789f0, 0x0f83b38f 139 1.1 christos TEST_ROR 0xb38f0f83, 0xffffffff, 0x671e1f07 140 1.1 christos 141 1.1 christos /* Test the l.rori instruction. */ 142 1.1 christos 143 1.1 christos /* Rotate by zero */ 144 1.1 christos TEST_RORI 0xb38f0f83, 0x00000000, 0xb38f0f83 145 1.1 christos 146 1.1 christos /* Rotate by amounts in the 1 - 31 range. */ 147 1.1 christos TEST_RORI 0xb38f0f83, 0x01, 0xd9c787c1 148 1.1 christos TEST_RORI 0xb38f0f83, 0x04, 0x3b38f0f8 149 1.1 christos TEST_RORI 0xb38f0f83, 0x10, 0x0f83b38f 150 1.1 christos TEST_RORI 0xb38f0f83, 0x1f, 0x671e1f07 151 1.1 christos 152 1.1 christos /* Rotate by larger amounts (32 - 63) - should be masked. */ 153 1.1 christos TEST_RORI 0xb38f0f83, 0x21, 0xd9c787c1 154 1.1 christos TEST_RORI 0xb38f0f83, 0x24, 0x3b38f0f8 155 1.1 christos TEST_RORI 0xb38f0f83, 0x30, 0x0f83b38f 156 1.1 christos TEST_RORI 0xb38f0f83, 0x3f, 0x671e1f07 157 1.1 christos 158 1.1 christos POP LINK_REGISTER_R9 159 1.1 christos RETURN_TO_LINK_REGISTER_R9 160