Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr112600-3a.c

raw
1 /* PR middle-end/112600 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -ftree-vectorize -msse2" } */
4
5 #define MIN -128
6 #define MAX 127
7
8 typedef char T;
9 typedef unsigned char UT;
10
11 void foo (T *out, T *op_1, T *op_2, int n)
12 {
13 int i;
14
15 for (i = 0; i < n; i++)
16 {
17 T x = op_1[i];
18 T y = op_2[i];
19 T sum = (UT) x + (UT) y;
20
21 out[i] = (x ^ y) < 0 ? sum : (sum ^ x) >= 0 ? sum : x < 0 ? MIN : MAX;
22 }
23 }
24
25 /* { dg-final { scan-assembler "paddsb" } } */