PR target/84226
[official-gcc.git] / gcc / testsuite / gcc.target / frv / fr405-builtins-1.c
blob98e304e278a3f01249dbedddce2bdaebb96dfc1c
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);
8 int main ()
10 long long res, res1, res2, res3;
12 __SMU (0x12345678, 0x40004000);
13 __SMASS (0x12000000, 0x11223344);
14 __SMSSS (0x01020304, 0x54321000);
16 res = __IACCreadll (0);
17 res1 = 0x12345678LL * 0x40004000LL;
18 res2 = 0x12000000LL * 0x11223344LL;
19 res3 = 0x01020304LL * 0x54321000LL;
20 if (res != res1 + res2 - res3)
21 abort ();
23 __IACCsetll (0, 0x7ffffffffffffff0LL);
24 __SMASS (0x100, 0x100);
25 if (__IACCreadll (0) != 0x7fffffffffffffffLL)
26 abort ();
28 __IACCsetl (0, -0x7ffffffe);
29 __IACCsetl (1, 0);
30 __SMSSS (0x10001, 0x10000);
31 if (__IACCreadl (0) != -0x7fffffff - 1 || __IACCreadl (1) != -0x10000)
32 abort ();
34 __SMSSS (0x10001, 0x10000);
35 if (__IACCreadl (0) != -0x7fffffff - 1 || __IACCreadl (1) != 0)
36 abort ();
38 exit (0);