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