1# Blackfin testcase for BYTEOP2P
2# mach: bfin
3
4	.include "testutils.inc"
5
6	start
7
8	.macro check_it res:req
9	imm32 R7, \res
10	CC = R6 == R7;
11	IF !CC JUMP 1f;
12	.endm
13	.macro test_byteop2p i0:req, resRL:req, resRH:req, resTL:req, resTH:req, resRLr:req, resRHr:req, resTLr:req, resTHr:req
14	dmm32 I0, \i0
15
16	R6 = BYTEOP2P (R1:0, R3:2) (rndl);
17	check_it \resRL
18	R6 = BYTEOP2P (R1:0, R3:2) (rndh);
19	check_it \resRH
20	R6 = BYTEOP2P (R1:0, R3:2) (tl);
21	check_it \resTL
22	R6 = BYTEOP2P (R1:0, R3:2) (th);
23	check_it \resTH
24	R6 = BYTEOP2P (R1:0, R3:2) (rndl, r);
25	check_it \resRLr
26	R6 = BYTEOP2P (R1:0, R3:2) (rndh, r);
27	check_it \resRHr
28	R6 = BYTEOP2P (R1:0, R3:2) (tl, r);
29	check_it \resTLr
30	R6 = BYTEOP2P (R1:0, R3:2) (th, r);
31	check_it \resTHr
32
33	jump 2f;
341:	fail
352:
36	.endm
37
38	imm32 R0, 0x01020304
39	imm32 R1, 0x10203040
40	imm32 R2, 0x0a0b0c0d
41	imm32 R3, 0xa0b0c0d0
42
43	test_byteop2p 0, 0x00060008, 0x06000800, 0x00060008, 0x06000800, 0x00600080, 0x60008000, 0x00600080, 0x60008000
44	test_byteop2p 1, 0x00470007, 0x47000700, 0x00460007, 0x46000700, 0x00300070, 0x30007000, 0x00300070, 0x30007000
45	test_byteop2p 2, 0x00800006, 0x80000600, 0x00800006, 0x80000600, 0x00080060, 0x08006000, 0x00080060, 0x08006000
46	test_byteop2p 3, 0x00700047, 0x70004700, 0x00700046, 0x70004600, 0x00070030, 0x07003000, 0x00070030, 0x07003000
47
48	imm32 R0, ~0x01020304
49	imm32 R1, ~0x10203040
50	imm32 R2, ~0x0a0b0c0d
51	imm32 R3, ~0xa0b0c0d0
52
53	test_byteop2p 0, 0x00f900f7, 0xf900f700, 0x00f900f7, 0xf900f700, 0x009f007f, 0x9f007f00, 0x009f007f, 0x9f007f00
54	test_byteop2p 1, 0x00b800f8, 0xb800f800, 0x00b800f8, 0xb800f800, 0x00cf008f, 0xcf008f00, 0x00ce008f, 0xce008f00
55	test_byteop2p 2, 0x007f00f9, 0x7f00f900, 0x007f00f9, 0x7f00f900, 0x00f7009f, 0xf7009f00, 0x00f7009f, 0xf7009f00
56	test_byteop2p 3, 0x008f00b8, 0x8f00b800, 0x008f00b8, 0x8f00b800, 0x00f800cf, 0xf800cf00, 0x00f800ce, 0xf800ce00
57
58	pass
59