OSDN Git Service

Revert "nir/builder: Assert that intN_t immediates fit"
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 20 Nov 2018 08:24:28 +0000 (09:24 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Wed, 21 Nov 2018 07:12:50 +0000 (08:12 +0100)
commit8e73b5763448876010aee0c6fd7f59541179d080
treeff124a7cf63af64089577da1ed7fa520352eabd8
parent387888e3b7c251548abe0eb641d2d795d4afd1d5
Revert "nir/builder: Assert that intN_t immediates fit"

This reverts commit 1f29f4db1e867357a119c0c7c34fb54dc27fb682.

For this to work the compiler must ensure that it never puts
the values that arrive to this helper into unsigned variables
at any point in its processing, since that would not apply sign
extension to the value and it would break the expectations here.
Unfortunately, we use uint64_t extensively to pass and copy
things around, so some times we get to this helper with values
that are not properly sign extended to 64-bit. Here is an example
for an 8-bit value that comes from a switch case:

(gdb) p /x x
$1 = 0xffffffd6

The value seems to have been sign extended to 32-bit at some point
getting proper sign extension, but then copied into a uint64_t
which wont' apply sign extension, breaking the expectations of
the assertion.

Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_builder.h