1//  MAC test program.
2//  Test result extraction of mac instructions.
3//  Test basic edge values
4//  UNSIGNED INTEGER mode into SINGLE destination register
5//  test ops: "+="
6# mach: bfin
7
8.include "testutils.inc"
9	start
10
11
12// load r0=0x80000002
13// load r1=0x80007fff
14// load r2=0xf0000000
15// load r3=0x0000007f
16// load r4=0x00000080
17// load r5=0xffffffff
18	loadsym P0, data0;
19	R0 = [ P0 ++ ];
20	R1 = [ P0 ++ ];
21	R2 = [ P0 ++ ];
22	R3 = [ P0 ++ ];
23	R4 = [ P0 ++ ];
24	R5 = [ P0 ++ ];
25
26// 0x0002 * 0x0002 = 0x0000000004 -> 0x0004
27	A1 = A0 = 0;
28	R5.H = (A1 += R0.L * R0.L), R5.L = (A0 += R0.L * R0.L) (IU);
29	DBGA ( R5.L , 0x4 );
30	DBGA ( R5.H , 0x4 );
31
32// 0x7fff * 0x007f = 0x00003f7f81 -> 0xffff
33	A1 = A0 = 0;
34	R5.H = (A1 += R1.L * R3.L), R5.L = (A0 += R1.L * R3.L) (IU);
35	R5.H = (A1 += R1.L * R3.L), R5.L = (A0 += R1.L * R3.L) (IU);
36	DBGA ( R5.L , 0xffff );
37	DBGA ( R5.H , 0xffff );
38
39	pass
40
41	.data;
42data0:
43	.dw 0x0002
44	.dw 0x8000
45	.dw 0x7fff
46	.dw 0x8000
47	.dw 0x0000
48	.dw 0xf000
49	.dw 0x007f
50	.dw 0x0000
51	.dw 0x0080
52	.dw 0x0000
53	.dw 0xffff
54	.dw 0xffff
55