1 |
691 |
jeremybenn |
/* { dg-options "-O3 -mcpu=v6.00.a -mxl-barrel-shift -mno-xl-soft-mul -mxl-pattern-compare -mxl-multiply-high" } */
|
2 |
|
|
|
3 |
|
|
volatile int m1, m2, m3;
|
4 |
|
|
volatile unsigned int u1, u2, u3;
|
5 |
|
|
volatile long l1, l2;
|
6 |
|
|
volatile long long llp;
|
7 |
|
|
|
8 |
|
|
volatile unsigned long ul1, ul2;
|
9 |
|
|
volatile unsigned long long ullp;
|
10 |
|
|
|
11 |
|
|
int test_mul () {
|
12 |
|
|
|
13 |
|
|
/* { dg-final { scan-assembler "mul\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */
|
14 |
|
|
m1 = m2 * m3 ;
|
15 |
|
|
|
16 |
|
|
/* { dg-final { scan-assembler "muli\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),(0x\[0-9a-fA-F]+|\[+-]*\[0-9]+)" } } */
|
17 |
|
|
m3 = m1 * 1234 ;
|
18 |
|
|
|
19 |
|
|
/* { dg-final { scan-assembler "mulh\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */
|
20 |
|
|
llp = (long long)l1 * l2;
|
21 |
|
|
|
22 |
|
|
/* { dg-final { scan-assembler "mulhu\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */
|
23 |
|
|
ullp = (unsigned long long)ul1 * ul2;
|
24 |
|
|
|
25 |
|
|
/* { dg-final { scan-assembler "mulhsu\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */
|
26 |
|
|
llp = (long long)l1 * ul2;
|
27 |
|
|
|
28 |
|
|
/* { dg-final { scan-assembler "bslli\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),25" } } */
|
29 |
|
|
m3 = m2 << 25;
|
30 |
|
|
|
31 |
|
|
/* { dg-final { scan-assembler "bsll\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */
|
32 |
|
|
m2 = m1 << m3;
|
33 |
|
|
|
34 |
|
|
/* { dg-final { scan-assembler "bsrai\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),25" } } */
|
35 |
|
|
m3 = m2 >> 25;
|
36 |
|
|
|
37 |
|
|
/* { dg-final { scan-assembler "bsra\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */
|
38 |
|
|
m2 = m1 >> m3;
|
39 |
|
|
|
40 |
|
|
/* { dg-final { scan-assembler-not "idiv" } } */
|
41 |
|
|
m1 = m2 / m1;
|
42 |
|
|
|
43 |
|
|
/* { dg-final { scan-assembler-not "idivu" } } */
|
44 |
|
|
u1 = u2 / u3;
|
45 |
|
|
|
46 |
|
|
/* { dg-final { scan-assembler "pcmpne\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */
|
47 |
|
|
m3 = (m3 != m1);
|
48 |
|
|
|
49 |
|
|
/* { dg-final { scan-assembler "pcmpeq\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */
|
50 |
|
|
return (m1 == m2);
|
51 |
|
|
|
52 |
|
|
}
|
53 |
|
|
|