tile: Check for pointer add overflow in memchr
commit502697713f4f129b602d7213253a9982ee1989f1
authorChris Metcalf <cmetcalf@mellanox.com>
Mon, 16 Jan 2017 20:38:25 +0000 (16 15:38 -0500)
committerChris Metcalf <cmetcalf@mellanox.com>
Mon, 16 Jan 2017 20:44:48 +0000 (16 15:44 -0500)
tree933c5eb4537e278df0cb0e2e664c40bc0afe6b38
parent4cb89c158124c27006903f10e309b09d5311053a
tile: Check for pointer add overflow in memchr

As was done in b224637928e9, check for large size causing an overflow
in the loop that walks over the array.

Branching out of line here is the fastest approach for handling this
problem, since tile can bundle the instructions to compute the branch
test in parallel with doing the required memchr loop setup computation.

Unfortunately, the existing saturated ops (e.g. tilegx addxsc) are
all signed saturing ops, so don't help with unsigned saturation.
ChangeLog
sysdeps/tile/tilegx/memchr.c
sysdeps/tile/tilepro/memchr.c