(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
torture/
pr58670.c
       1  /* PR middle-end/58670 */
       2  /* { dg-do run { target i?86-*-* x86_64-*-* } } */
       3  
       4  #if defined (__i386__) || defined (__x86_64__)
       5  #define ASM_STR "btsl $1, %0; jc %l[lab]"
       6  #endif
       7  
       8  __attribute__((noinline, noclone)) int
       9  foo (int a, int b)
      10  {
      11    if (a)
      12      return -3;
      13  #ifdef ASM_STR
      14    asm volatile goto (ASM_STR : : "m" (b) : "memory" : lab);
      15    return 0;
      16  lab:
      17  #endif
      18    return 0;
      19  }
      20  
      21  int
      22  bar (int a, int b)
      23  {
      24    if (a)
      25      return -3;
      26  #ifdef ASM_STR
      27    asm volatile goto (ASM_STR : : "m" (b) : "memory" : lab);
      28    return 0;
      29  lab:
      30  #endif
      31    return 0;
      32  }
      33  
      34  int
      35  main ()
      36  {
      37    if (foo (1, 0) != -3
      38        || foo (0, 3) != 0
      39        || foo (1, 0) != -3
      40        || foo (0, 0) != 0
      41        || bar (1, 0) != -3
      42        || bar (0, 3) != 0
      43        || bar (1, 0) != -3
      44        || bar (0, 0) != 0)
      45      __builtin_abort ();
      46    return 0;
      47  }