(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
nios2/
cdx-logical.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -march=r2 -mcdx" } */
       3  
       4  /* Check generation of R2 CDX and.n, andi.n, or.n, xor.n, and not.n
       5     instructions.
       6  
       7     and.n, or.n, and x.n require one of the input registers to be the same
       8     as the output register.  Since the tests below want to put the result
       9     in the return value register, they use this function to make sure that
      10     one of the input operands is also already in the return register.  */
      11  
      12  extern unsigned int x (unsigned int a);
      13  
      14  unsigned int f (unsigned int a, unsigned int b)
      15  {
      16    return x (a) & b;
      17  }
      18  
      19  unsigned int g (unsigned int a)
      20  {
      21    return a & 31;
      22  }
      23  
      24  unsigned int h (unsigned int a, unsigned int b)
      25  {
      26    return x (a) | b;
      27  }
      28  
      29  unsigned int i (unsigned int a, unsigned int b)
      30  {
      31    return x (a) ^ b;
      32  }
      33  
      34  unsigned int j (unsigned int a)
      35  {
      36    return ~a;
      37  }
      38  
      39  /* { dg-final { scan-assembler "\tand\\.n\t.*" } } */
      40  /* { dg-final { scan-assembler "\tandi\\.n\t.*, 31" } } */
      41  /* { dg-final { scan-assembler "\tor\\.n\t.*" } } */
      42  /* { dg-final { scan-assembler "\txor\\.n\t.*" } } */
      43  /* { dg-final { scan-assembler "\tnot\\.n\t.*" } } */