RISC-V: Add support for riscv-*-*.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / compile / pr38554.c
blob7d40a223be0cfc44b86ff749d1c18d0ea63df2b3
1 typedef unsigned long sample;
2 struct pam
4 sample maxval;
5 };
6 typedef sample *tuple;
7 enum function
9 FN_MULTIPLY, FN_DIVIDE, FN_ADD, FN_SUBTRACT, FN_MIN, FN_MAX, FN_AND, FN_OR,
10 FN_XOR, FN_NOT, FN_SHIFTLEFT, FN_SHIFTRIGHT
12 struct cmdlineInfo
14 enum function function;
15 union
17 float divisor;
18 unsigned int shiftCount;
22 applyFunction (struct cmdlineInfo const cmdline, struct pam const inpam,
23 struct pam const outpam, tuple * const inputRow,
24 tuple * const outputRow)
26 float const oneOverDivisor = 1 / cmdline.u.divisor;
27 int col;
29 int plane;
31 sample const inSample = inputRow[col][plane];
32 sample outSample;
33 switch (cmdline.function)
35 case FN_DIVIDE:
36 outSample = ((unsigned int) ((inSample * oneOverDivisor) + 0.5));
37 break;
38 case FN_SHIFTLEFT:
39 outSample = (inSample << cmdline.u.shiftCount) & outpam.maxval;
41 outputRow[col][plane] =
42 ((outpam.maxval) < (outSample) ? (outpam.maxval) : (outSample));