blob: b670dee8d1025164e6874d4abc30cc0f99d8b59c (
plain)
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
69
70
|
/* { dg-do run } */
/* Note both PHI-OPT and the loop if conversion pass converts the inner if to be branchless using min/max. */
/* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details --param max-jump-thread-duplication-stmts=20 -fno-ssa-phiopt -fno-tree-loop-if-convert" } */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define RGBMAX 255
unsigned char
test()
{
int i, Pels;
int sum = 0;
unsigned char xr, xg, xb;
unsigned char xc, xm, xy, xk = 0;
unsigned char *ReadPtr, *EritePtr;
ReadPtr = ( unsigned char *) malloc (sizeof (unsigned char) * 100);
EritePtr = ( unsigned char *) malloc (sizeof (unsigned char) * 100);
for (i = 0; i < 100;i++)
{
ReadPtr[i] = 100 - i;
}
for (i = 0; i < 24; i++)
{
xr = *ReadPtr++;
xg = *ReadPtr++;
xb = *ReadPtr++;
xc = (unsigned char) (RGBMAX - xr);
xm = (unsigned char) (RGBMAX - xg);
xy = (unsigned char) (RGBMAX - xb);
if (xc < xm)
{
xk = (unsigned char) (xc < xy ? xc : xy);
}
else
{
xk = (unsigned char) (xm < xy ? xm : xy);
}
xc = (unsigned char) (xc - xk);
xm = (unsigned char) (xm - xk);
xy = (unsigned char) (xy - xk);
*EritePtr++ = xc;
*EritePtr++ = xm;
*EritePtr++ = xy;
*EritePtr++ = xk;
sum += *(--EritePtr);
}
return sum;
}
int
main()
{
if (test() != 196)
abort();
return 0;
}
/* { dg-final { scan-tree-dump "Duplicating join block" "split-paths" } } */
|