view gcc/testsuite/gcc.dg/tree-prof/pr59521-3.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line source

/* { dg-options "-O2 -save-temps" } */

#include <stdio.h>

__attribute__((noinline,noclone)) void
sink(const char *s) {
  asm("" :: "r"(s));
}

void
foo(int ch) {
  switch (ch) {
    case 100: sink("100"); break;
    case 10: sink("10"); break;
    case 1: sink("1"); break;
    } 
}

int main()
{
  for (int i = 0; i < 10000; i++)
  {
    int v;
    if (i % 100 == 0)
      v = 100;
    else if(i % 10 == 0)
      v = 10;
    else
      v = 1;
    foo(v);
  }
}

/* { dg-final-use-not-autofdo { scan-assembler "\n_?foo:\n.*cmp.*1,.*cmp.*10,.*cmp.*100" { target i?86-*-* x86_64-*-* } } } */