Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/gcc.dg/pr46309.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/gcc.dg/pr46309.c Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,68 @@ +/* PR tree-optimization/46309 */ +/* { dg-do compile { target { { ! logical_op_short_circuit } || { mips*-*-* avr*-*-* } } } } */ +/* { dg-options "-O2 -fdump-tree-reassoc-details" } */ +/* The transformation depends on BRANCH_COST being greater than 1 + (see the notes in the PR), so try to force that. */ +/* { dg-additional-options "-mtune=octeon2" { target mips*-*-* } } */ +/* { dg-additional-options "-mbranch-cost=2" { target avr*-*-* s390*-*-* i?86-*-* x86_64-*-* } } */ + +int +f1 (int a) +{ + int v1 = (a == 3); + int v2 = (a == 1); + int v3 = (a == 4); + int v4 = (a == 2); + return v1 || v2 || v3 || v4; +} + +int +f2 (int a) +{ + int v1 = (a == 1); + int v2 = (a == 2); + int v3 = (a == 3); + int v4 = (a == 4); + return v1 || v2 || v3 || v4; +} + +int +f3 (int a) +{ + int v1 = (a == 3); + int v2 = (a == 1); + return v1 || v2; +} + +int +f4 (int a) +{ + int v1 = (a == 1); + int v2 = (a == 2); + return v1 || v2; +} + +int +f5 (unsigned int a) +{ + int v1 = (a <= 31); + int v2 = (a >= 64 && a <= 95); + return v1 || v2; +} + +int +f6 (unsigned int a) +{ + int v1 = (a <= 31); + int v2 = (a >= 64 && a <= 95); + int v3 = (a >= 128 && a <= 159); + int v4 = (a >= 192 && a <= 223); + return v1 || v2 || v3 || v4; +} + +/* { dg-final { scan-tree-dump-times "Optimizing range tests a_\[0-9\]*.D. -.1, 1. and -.2, 2. and -.3, 3. and -.4, 4.\[\n\r\]* into" 2 "reassoc1" } } */ +/* { dg-final { scan-tree-dump-times "Optimizing range tests a_\[0-9\]*.D. -.1, 1. and -.3, 3.\[\n\r\]* into" 1 "reassoc1" } } */ +/* { dg-final { scan-tree-dump-times "Optimizing range tests a_\[0-9\]*.D. -.1, 1. and -.2, 2.\[\n\r\]* into" 1 "reassoc1" } } */ +/* { dg-final { scan-tree-dump-times "Optimizing range tests a_\[0-9\]*.D. -.0, 31. and -.64, 95.\[\n\r\]* into" 2 "reassoc1" } } */ +/* { dg-final { scan-tree-dump-times "Optimizing range tests a_\[0-9\]*.D. -.128, 159. and -.192, 223.\[\n\r\]* into" 1 "reassoc1" } } */ +/* { dg-final { scan-tree-dump-times "Optimizing range tests \[^\r\n\]*_\[0-9\]* -.0, 0. and -.128, 128.\[\n\r\]* into" 1 "reassoc2" } } */