]>
Commit | Line | Data |
---|---|---|
1de80b0e RS |
1 | /* From PR rtl-optimization/19683. On little-endian MIPS targets, |
2 | reload would incorrectly inherit the high part of the multiplication | |
3 | result. */ | |
4 | /* { dg-do run { target mips*-*-* } } */ | |
5 | ||
6 | extern void abort (void); | |
7 | extern void exit (int); | |
8 | ||
9 | #define REPEAT10(X, Y) \ | |
10 | X(Y##0); X(Y##1); X(Y##2); X(Y##3); X(Y##4); \ | |
11 | X(Y##5); X(Y##6); X(Y##7); X(Y##8); X(Y##9) | |
12 | ||
13 | #define REPEAT30(X) REPEAT10 (X, 0); REPEAT10 (X, 1); REPEAT10 (X, 2) | |
14 | #define IN(X) unsigned int x##X = ptr[0] | |
15 | #define OUT(X) ptr[0] = x##X | |
16 | ||
82f84ecb | 17 | #if __mips_isa_rev <= 5 |
1de80b0e RS |
18 | union u { unsigned long long ll; unsigned int i[2]; }; |
19 | ||
1333282d | 20 | unsigned int __attribute__ ((nomips16)) |
1de80b0e RS |
21 | foo (volatile unsigned int *ptr) |
22 | { | |
23 | union u u; | |
24 | int result; | |
25 | ||
26 | u.ll = (unsigned long long) ptr[0] * ptr[0]; | |
27 | REPEAT30 (IN); | |
28 | REPEAT30 (OUT); | |
29 | asm ("#" : "=l" (result) : "l" (u.i[1])); | |
30 | return result; | |
31 | } | |
82f84ecb | 32 | #endif |
1de80b0e | 33 | |
1333282d | 34 | int __attribute__ ((nomips16)) |
1de80b0e RS |
35 | main (void) |
36 | { | |
82f84ecb | 37 | #if __mips_isa_rev <= 5 |
1de80b0e RS |
38 | unsigned int array[] = { 1000 * 1000 * 1000 }; |
39 | union u u; | |
40 | ||
41 | u.ll = (unsigned long long) array[0] * array[0]; | |
42 | if (foo (array) != u.i[1]) | |
43 | abort (); | |
82f84ecb | 44 | #endif |
1de80b0e RS |
45 | exit (0); |
46 | } |