summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/pr54089-7.c
blob: 40ca8219a2fb307914a748e038a8f7826651fdd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* Check that the rotcr instruction is generated.  */
/* { dg-do compile { target "sh*-*-*" } } */
/* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } }  */
/* { dg-final { scan-assembler-times "rotcr" 4 } } */
/* { dg-final { scan-assembler-not "movt" } } */
/* { dg-final { scan-assembler-not "or\t" } } */
/* { dg-final { scan-assembler-not "rotr" } } */
/* { dg-final { scan-assembler-not "and" } } */

typedef char bool;

int
test_00 (int* a, int* b)
{
  int i;
  unsigned int r = 0;
  for (i = 0; i < 16; ++i)
    {
      bool t = a[i] == b[i];
      r = (t << 31) | (r >> 1);
    }
  return r;
}

int
test_01 (int* a, int* b)
{
  int i;
  unsigned int r = 0;
  for (i = 0; i < 16; ++i)
    {
      bool t = a[i] == b[i];
      r = (t << 31) | (r >> 2);
    }
  return r;
}

int
test_02 (int* a, int* b)
{
  int i;
  unsigned int r = 0;
  for (i = 0; i < 16; ++i)
    {
      bool t = a[i] == b[i];
      r = (t << 31) | (r >> 3);
    }
  return r;
}

unsigned int
test_03 (const bool* a)
{
  int i;
  unsigned int r = 0;
  for (i = 0; i < 32; ++i)
    {
      bool t = a[i];
      r = (t << 31) | (r >> 1);
    }
  return r;
}