view gcc/testsuite/gcc.target/aarch64/imm_choice_comparison.c @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 84e7813d76e9
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-options "-O2" } */

/* Go from four moves to two.  */

int
foo (long long x)
{
  return x <= 0x1999999999999998;
}

int
GT (unsigned int x)
{
  return x > 0xfefffffe;
}

int
LE (unsigned int x)
{
  return x <= 0xfefffffe;
}

int
GE (long long x)
{
  return x >= 0xff000000;
}

int
LT (int x)
{
  return x < 0xff000000;
}

/* Optimize the immediate in conditionals.  */

int
check (int x, int y)
{
  if (x > y && GT (x))
    return 100;

  return x;
}

int
tern (int x)
{
  return x >= 0xff000000 ? 5 : -3;
}

/* baz produces one movk instruction.  */
/* { dg-final { scan-assembler-times "movk" 1 } } */