1/* Tests the find instructions.
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(0x00000001);\n
20# output: report(0x00000001);\n
21# output: \n
22# output: report(0x80000000);\n
23# output: report(0x00000020);\n
24# output: \n
25# output: report(0x55555555);\n
26# output: report(0x00000001);\n
27# output: \n
28# output: report(0xaaaaaaaa);\n
29# output: report(0x00000002);\n
30# output: \n
31# output: report(0x00018000);\n
32# output: report(0x00000010);\n
33# output: \n
34# output: report(0xc0000000);\n
35# output: report(0x0000001f);\n
36# output: \n
37# output: report(0x00000000);\n
38# output: report(0x00000000);\n
39# output: \n
40# output: report(0x00000001);\n
41# output: report(0x00000001);\n
42# output: \n
43# output: report(0x80000000);\n
44# output: report(0x00000020);\n
45# output: \n
46# output: report(0x55555555);\n
47# output: report(0x0000001f);\n
48# output: \n
49# output: report(0xaaaaaaaa);\n
50# output: report(0x00000020);\n
51# output: \n
52# output: report(0x00018000);\n
53# output: report(0x00000011);\n
54# output: \n
55# output: report(0xc0000000);\n
56# output: report(0x00000020);\n
57# output: \n
58# output: report(0x00000000);\n
59# output: report(0x00000000);\n
60# output: \n
61# output: exit(0)\n
62
63#include "or1k-asm-test-helpers.h"
64
65	.macro TEST_FIND opcode, operand
66	LOAD_IMMEDIATE r5, \operand
67	REPORT_REG_TO_CONSOLE r5
68	\opcode r4, r5
69	REPORT_REG_TO_CONSOLE r4
70	PRINT_NEWLINE_TO_CONSOLE
71	.endm
72
73	STANDARD_TEST_ENVIRONMENT
74
75	.section .text
76start_tests:
77	PUSH LINK_REGISTER_R9
78
79	/* Test l.ff1  */
80
81	TEST_FIND l.ff1, 0x00000001
82	TEST_FIND l.ff1, 0x80000000
83	TEST_FIND l.ff1, 0x55555555
84	TEST_FIND l.ff1, 0xaaaaaaaa
85	TEST_FIND l.ff1, 0x00018000
86	TEST_FIND l.ff1, 0xc0000000
87	TEST_FIND l.ff1, 0x00000000
88
89	/* Test l.fl1  */
90
91	TEST_FIND l.fl1, 0x00000001
92	TEST_FIND l.fl1, 0x80000000
93	TEST_FIND l.fl1, 0x55555555
94	TEST_FIND l.fl1, 0xaaaaaaaa
95	TEST_FIND l.fl1, 0x00018000
96	TEST_FIND l.fl1, 0xc0000000
97	TEST_FIND l.fl1, 0x00000000
98
99	POP LINK_REGISTER_R9
100	RETURN_TO_LINK_REGISTER_R9
101