1 /* Test the IACC multiply/accumulate instructions. Also test the IACC
2 read/write functions. */
3 /* { dg-options "-mcpu=fr405" } */
4 /* { dg-do run } */
5 extern void abort (void);
6 extern void exit (int);
7
main()8 int main ()
9 {
10 long long res, res1, res2, res3;
11
12 __SMU (0x12345678, 0x40004000);
13 __SMASS (0x12000000, 0x11223344);
14 __SMSSS (0x01020304, 0x54321000);
15
16 res = __IACCreadll (0);
17 res1 = 0x12345678LL * 0x40004000LL;
18 res2 = 0x12000000LL * 0x11223344LL;
19 res3 = 0x01020304LL * 0x54321000LL;
20 if (res != res1 + res2 - res3)
21 abort ();
22
23 __IACCsetll (0, 0x7ffffffffffffff0LL);
24 __SMASS (0x100, 0x100);
25 if (__IACCreadll (0) != 0x7fffffffffffffffLL)
26 abort ();
27
28 __IACCsetl (0, -0x7ffffffe);
29 __IACCsetl (1, 0);
30 __SMSSS (0x10001, 0x10000);
31 if (__IACCreadl (0) != -0x7fffffff - 1 || __IACCreadl (1) != -0x10000)
32 abort ();
33
34 __SMSSS (0x10001, 0x10000);
35 if (__IACCreadl (0) != -0x7fffffff - 1 || __IACCreadl (1) != 0)
36 abort ();
37
38 exit (0);
39 }
40