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