Debian Codegraph @

gcc/testsuite/g++.dg/tree-ssa/ifcombine-ccmp-1.C

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -g -fdump-tree-optimized --param logical-op-non-short-circuit=1" } */
3
4 /* PR tree-optimization/85605 */
5 #include <stdint.h>
6
7 template<class T,class T2>
8 inline bool cmp(T a, T2 b) {
9 return a<0 ? true : T2(a) < b;
10 }
11
12 template<class T,class T2>
13 inline bool cmp2(T a, T2 b) {
14 return (a<0) | (T2(a) < b);
15 }
16
17 bool f(int a, int b) {
18 return cmp(int64_t(a), unsigned(b));
19 }
20
21 bool f2(int a, int b) {
22 return cmp2(int64_t(a), unsigned(b));
23 }
24
25
26 /* Both of these functions should be optimized to the same, and have an | in them. */
27 /* { dg-final { scan-tree-dump-times " \\\| " 2 "optimized" } } */