OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [sh/] [sh2a-bset.c] - Blame information for rev 859

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 325 jeremybenn
/* Testcase to check generation of a SH2A specific instruction
2
  'BSET #imm3,Rn'.  */
3
/* { dg-do assemble {target sh*-*-*}}  */
4
/* { dg-options "-O1" }  */
5
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" }  */
6
/* { dg-final { scan-assembler "bset"} }  */
7
 
8
struct a
9
{
10
  char a, b;
11
  short c;
12
};
13
 
14
/* This function generates the instruction "BSET #imm3,Rn" only
15
   on using optimization option "-O1" and above.  */
16
 
17
int
18
a2 ()
19
{
20
  volatile int j;
21
  volatile static struct a x = {1, 66, ~1}, y = {1, 2, ~2};
22
 
23
  if (j > 1)
24
    return (x.a == y.a && (x.b | 1) == y.b);
25
  if (j > 2)
26
    return (x.a == y.a && (x.b | 2) == y.b);
27
  if (j > 3)
28
    return (x.a == y.a && (x.b | 4) == y.b);
29
  if (j > 4)
30
    return (x.a == y.a && (x.b | 8) == y.b);
31
  if (j > 5)
32
    return (x.a == y.a && (x.b | 16) == y.b);
33
  if (j > 6)
34
    return (x.a == y.a && (x.b | 32) == y.b);
35
  if (j > 7)
36
    return (x.a == y.a && (x.b | 64) == y.b);
37
  if (j > 8)
38
    return (x.a == y.a && (x.b | 128) == y.b);
39
}
40
 
41
int
42
main ()
43
{
44
  volatile unsigned char x;
45
 
46
  x |= 0x1;
47
  x |= 0x2;
48
  x |= 0x4;
49
  x |= 0x8;
50
  x |= 0x16;
51
  x |= 0x32;
52
  x |= 0x64;
53
  x |= 0x128;
54
 
55
  if (!a2 ())
56
    return 0;
57
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.