Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.target/arm/pr37780_1.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
line wrap: on
line source
/* Test that we can remove the conditional move due to CLZ being defined at zero. */ /* { dg-do compile } */ /* { dg-require-effective-target arm_arch_v6t2_ok } */ /* { dg-options "-O2" } */ /* { dg-add-options arm_arch_v6t2 } */ int fooctz (int i) { return (i == 0) ? 32 : __builtin_ctz (i); } int fooctz2 (int i) { return (i != 0) ? __builtin_ctz (i) : 32; } unsigned int fooctz3 (unsigned int i) { return (i > 0) ? __builtin_ctz (i) : 32; } /* { dg-final { scan-assembler-times "rbit\t*" 3 } } */ int fooclz (int i) { return (i == 0) ? 32 : __builtin_clz (i); } int fooclz2 (int i) { return (i != 0) ? __builtin_clz (i) : 32; } unsigned int fooclz3 (unsigned int i) { return (i > 0) ? __builtin_clz (i) : 32; } /* { dg-final { scan-assembler-times "clz\t" 6 } } */ /* { dg-final { scan-assembler-not "cmp\t.*0" } } */