summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile/pr38789.c
blob: 1a26b8055f43d6cffb2784a84502351789cf6a78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* PR tree-optimization/38789 */
/* { dg-do compile } */

void
baz (int v)
{
  unsigned a = (v == 1) ? 1 : 2;

  if (__builtin_constant_p (a))
    asm volatile ("# constant %0" :: "i" (a));
  else
    asm volatile ("# register %0" :: "r" (a));

  a = 6;
  if (__builtin_constant_p (a))
    asm volatile ("# constant %0" :: "i" (a));
  else
    asm volatile ("# register %0" :: "r" (a));
}