Add unit test for 11/10-bit minifloat denormal underflow
The reference code for conversion from 32-bit floating-point to 11- and
10-bit minifloat formats supports producing denormals for values smaller
than what can be represented as normalized representations. The
arithmetic can underflow to produce zero for values too small to be
represented as denormals.
This arithmetic contains a 32-bit shift operation which can shift by an
amount greater than 32, which has undefined behavior in C++ but produces
zero on x86 processors.
This change adds unit tests for the intended behavior around the cutoff
between the smallest denormal, and zero, to help validate the fix for
the UB in a future change.
Bug: b/147900455
Bug: chromium:1117433
Change-Id: Ic5e495dd822231d52a5551ee12733a616728d486
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/48068Reviewed-by:
Antonio Maiorano <amaiorano@google.com>
Tested-by:
Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Showing
Please
register
or
sign in
to comment