1/* Tests instructions l.and, l.andi.
2
3   Copyright (C) 2017-2023 Free Software Foundation, Inc.
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 3 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18# mach: or1k
19# output: report(0x00000000);\n
20# output: report(0x00000000);\n
21# output: report(0x00000000);\n
22# output: report(0x00000000);\n
23# output: report(0x00000000);\n
24# output: report(0x00000000);\n
25# output: \n
26# output: report(0xffffffff);\n
27# output: report(0xffffffff);\n
28# output: report(0xffffffff);\n
29# output: report(0x00000000);\n
30# output: report(0x00000000);\n
31# output: report(0x00000000);\n
32# output: \n
33# output: report(0xaaaaaaaa);\n
34# output: report(0x00000000);\n
35# output: report(0x00000000);\n
36# output: report(0x00000000);\n
37# output: report(0x00000000);\n
38# output: report(0x00000000);\n
39# output: \n
40# output: report(0xaaaaaaaa);\n
41# output: report(0xaaaaaaaa);\n
42# output: report(0xaaaaaaaa);\n
43# output: report(0x00000000);\n
44# output: report(0x00000000);\n
45# output: report(0x00000000);\n
46# output: \n
47# output: report(0x55555555);\n
48# output: report(0x00000000);\n
49# output: report(0x00000000);\n
50# output: report(0x00000000);\n
51# output: report(0x00000000);\n
52# output: report(0x00000000);\n
53# output: \n
54# output: report(0x55555555);\n
55# output: report(0x55555555);\n
56# output: report(0x55555555);\n
57# output: report(0x00000000);\n
58# output: report(0x00000000);\n
59# output: report(0x00000000);\n
60# output: \n
61# output: report(0xaaaaaaaa);\n
62# output: report(0x55555555);\n
63# output: report(0x00000000);\n
64# output: report(0x00000000);\n
65# output: report(0x00000000);\n
66# output: report(0x00000000);\n
67# output: \n
68# output: report(0x4c70f07c);\n
69# output: report(0xb38f0f83);\n
70# output: report(0x00000000);\n
71# output: report(0x00000000);\n
72# output: report(0x00000000);\n
73# output: report(0x00000000);\n
74# output: \n
75# output: report(0x4c70f07c);\n
76# output: report(0xc4c70f07);\n
77# output: report(0x44400004);\n
78# output: report(0x00000000);\n
79# output: report(0x00000000);\n
80# output: report(0x00000000);\n
81# output: \n
82# output: report(0xb38f0f83);\n
83# output: report(0x38f0f83b);\n
84# output: report(0x30800803);\n
85# output: report(0x00000000);\n
86# output: report(0x00000000);\n
87# output: report(0x00000000);\n
88# output: \n
89# output: report(0x00000000);\n
90# output: report(0x00000000);\n
91# output: report(0x00000000);\n
92# output: report(0x00000000);\n
93# output: report(0x00000000);\n
94# output: report(0x00000000);\n
95# output: \n
96# output: report(0xffffffff);\n
97# output: report(0x0000ffff);\n
98# output: report(0x0000ffff);\n
99# output: report(0x00000000);\n
100# output: report(0x00000000);\n
101# output: report(0x00000000);\n
102# output: \n
103# output: report(0xaaaaaaaa);\n
104# output: report(0x00000000);\n
105# output: report(0x00000000);\n
106# output: report(0x00000000);\n
107# output: report(0x00000000);\n
108# output: report(0x00000000);\n
109# output: \n
110# output: report(0xaaaaaaaa);\n
111# output: report(0x0000aaaa);\n
112# output: report(0x0000aaaa);\n
113# output: report(0x00000000);\n
114# output: report(0x00000000);\n
115# output: report(0x00000000);\n
116# output: \n
117# output: report(0x55555555);\n
118# output: report(0x00000000);\n
119# output: report(0x00000000);\n
120# output: report(0x00000000);\n
121# output: report(0x00000000);\n
122# output: report(0x00000000);\n
123# output: \n
124# output: report(0x55555555);\n
125# output: report(0x00005555);\n
126# output: report(0x00005555);\n
127# output: report(0x00000000);\n
128# output: report(0x00000000);\n
129# output: report(0x00000000);\n
130# output: \n
131# output: report(0xaaaaaaaa);\n
132# output: report(0x00005555);\n
133# output: report(0x00000000);\n
134# output: report(0x00000000);\n
135# output: report(0x00000000);\n
136# output: report(0x00000000);\n
137# output: \n
138# output: report(0x4c70f07c);\n
139# output: report(0x00000f83);\n
140# output: report(0x00000000);\n
141# output: report(0x00000000);\n
142# output: report(0x00000000);\n
143# output: report(0x00000000);\n
144# output: \n
145# output: report(0x4c70f07c);\n
146# output: report(0x00000f07);\n
147# output: report(0x00000004);\n
148# output: report(0x00000000);\n
149# output: report(0x00000000);\n
150# output: report(0x00000000);\n
151# output: \n
152# output: report(0xb38f0f83);\n
153# output: report(0x0000f83b);\n
154# output: report(0x00000803);\n
155# output: report(0x00000000);\n
156# output: report(0x00000000);\n
157# output: report(0x00000000);\n
158# output: \n
159# output: exit(0)\n
160
161#include "or1k-asm-test-helpers.h"
162
163	STANDARD_TEST_ENVIRONMENT
164
165	.section .text
166start_tests:
167	PUSH LINK_REGISTER_R9
168
169	/* Always set OVE.  We should never trigger an exception, even if
170	   this bit is set.  */
171	SET_SPR_SR_FLAGS SPR_SR_OVE, r2, r3
172
173	/* Test the l.and instruction with a range of operands.  */
174	TEST_INST_I32_I32 l.and, 0x00000000, 0x00000000
175	TEST_INST_I32_I32 l.and, 0xffffffff, 0xffffffff
176	TEST_INST_I32_I32 l.and, 0xaaaaaaaa, 0x00000000
177	TEST_INST_I32_I32 l.and, 0xaaaaaaaa, 0xaaaaaaaa
178	TEST_INST_I32_I32 l.and, 0x55555555, 0x00000000
179	TEST_INST_I32_I32 l.and, 0x55555555, 0x55555555
180	TEST_INST_I32_I32 l.and, 0xaaaaaaaa, 0x55555555
181	TEST_INST_I32_I32 l.and, 0x4c70f07c, 0xb38f0f83
182	TEST_INST_I32_I32 l.and, 0x4c70f07c, 0xc4c70f07
183	TEST_INST_I32_I32 l.and, 0xb38f0f83, 0x38f0f83b
184
185	/* Test the l.andi instruction with a range of operands.  */
186	TEST_INST_I32_I16 l.andi, 0x00000000, 0x0000
187	TEST_INST_I32_I16 l.andi, 0xffffffff, 0xffff
188	TEST_INST_I32_I16 l.andi, 0xaaaaaaaa, 0x0000
189	TEST_INST_I32_I16 l.andi, 0xaaaaaaaa, 0xaaaa
190	TEST_INST_I32_I16 l.andi, 0x55555555, 0x0000
191	TEST_INST_I32_I16 l.andi, 0x55555555, 0x5555
192	TEST_INST_I32_I16 l.andi, 0xaaaaaaaa, 0x5555
193	TEST_INST_I32_I16 l.andi, 0x4c70f07c, 0x0f83
194	TEST_INST_I32_I16 l.andi, 0x4c70f07c, 0x0f07
195	TEST_INST_I32_I16 l.andi, 0xb38f0f83, 0xf83b
196
197	POP LINK_REGISTER_R9
198	RETURN_TO_LINK_REGISTER_R9
199