1 /* Check that the rotcr instruction is generated. */
2 /* { dg-do compile { target "sh*-*-*" } } */
3 /* { dg-options "-O1" } */
4 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
5 /* { dg-final { scan-assembler-times "rotcl" 4 } } */
6 /* { dg-final { scan-assembler-not "movt" } } */
7 /* { dg-final { scan-assembler-not "or\t" } } */
8 /* { dg-final { scan-assembler-not "rotl" } } */
9 /* { dg-final { scan-assembler-not "and" } } */
10
11 typedef char bool;
12
13 int
test_00(int * a,int * b)14 test_00 (int* a, int* b)
15 {
16 int i;
17 int r = 0;
18 for (i = 0; i < 16; ++i)
19 {
20 bool t = a[i] == b[i];
21 r = (r << 1) | t;
22 }
23 return r;
24 }
25
26 int
test_01(int * a,int * b)27 test_01 (int* a, int* b)
28 {
29 int i;
30 int r = 0;
31 for (i = 0; i < 16; ++i)
32 {
33 bool t = a[i] == b[i];
34 r = (r << 2) | t;
35 }
36 return r;
37 }
38
39 int
test_02(int * a,int * b)40 test_02 (int* a, int* b)
41 {
42 int i;
43 int r = 0;
44 for (i = 0; i < 16; ++i)
45 {
46 bool t = a[i] == b[i];
47 r = (r << 3) | t;
48 }
49 return r;
50 }
51
52 int
test_03(const bool * a)53 test_03 (const bool* a)
54 {
55 int i;
56 int r = 0;
57 for (i = 0; i < 16; ++i)
58 {
59 bool t = a[i];
60 r = (r << 1) | (t & 1);
61 }
62 return r;
63 }
64