https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113481

--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Here is a somewhat reduced test:

/* { dg-do run } */
/* { dg-options "-g -O2" } */

typedef __UINT8_TYPE__ uint8_t;
typedef __uint24 uint24_t;

#define BBB 23
#define INC 1
#define VAL 0xcccccc

uint8_t Afun5 (uint24_t num)
{
  uint8_t b = 0;
  __asm ("sbrc %T1%T2 $ subi %0,%n3"
         : "+d" (b)
         : "r" (num), "n" (BBB), "n" (INC));
  return b;
}

uint8_t Cfun5 (uint24_t num)
{
  uint8_t b = 0;
  if (num & ((uint24_t) 1 << BBB))
    b += INC;
  return b;
}

int main (void)
{
  if (Afun5 (VAL) != Cfun5 (VAL))
    __builtin_abort();

  return 0;
}

Reply via email to