File: pr46309.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (68 lines) | stat: -rw-r--r-- 1,995 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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 branch_cost } } */

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" } } */