gcc/testsuite/gcc.target/i386/pr112600-5.h
raw| 1 | #ifndef HAVE_DEFINED_PR112600_5A_H |
| 2 | #define HAVE_DEFINED_PR112600_5A_H |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | #define DEF_SAT_ADD(T) \ |
| 7 | T sat_add_##T (T x, T y) \ |
| 8 | { \ |
| 9 | T res; \ |
| 10 | res = x + y; \ |
| 11 | res |= -(T)(res < x); \ |
| 12 | return res; \ |
| 13 | } |
| 14 | |
| 15 | #define VEC_DEF_SAT_ADD(T) \ |
| 16 | void vec_sat_add(T * restrict a, T * restrict b) \ |
| 17 | { \ |
| 18 | for (int i = 0; i < 16; i++) \ |
| 19 | b[i] = sat_add_##T (a[i], b[i]); \ |
| 20 | } |
| 21 | |
| 22 | #endif |