glsl: Add new expressions for INTEL_shader_integer_functions2
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 11 Sep 2018 05:38:29 +0000 (22:38 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Jan 2020 00:18:57 +0000 (00:18 +0000)
commit1d165b0548639df48c406fd6514298309e68aba9
tree501b0fb310674a620f635789b1e9a43937322d1f
parent20d34c4ebf07c98a40ea43b0cccc95537c176fa9
glsl: Add new expressions for INTEL_shader_integer_functions2

v2: Re-write iadd64_saturate and isub64_saturate to avoid undefined
overflow behavior.  Also fix copy-and-paste bug in isub64_saturate.
Suggested by Caio.

v3: Avoid signed integer overflow for abs_sub(0, INT_MIN).  Noticed by
Caio.

v4: Alternate fix for signed integer overflow for abs_sub(0, INT_MIN).
I tried the previous methon in a small test program with -ftrapv, and it
failed.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/767>
src/compiler/glsl/ir.cpp
src/compiler/glsl/ir_constant_expression.cpp
src/compiler/glsl/ir_expression_operation.py
src/compiler/glsl/ir_validate.cpp
src/mesa/program/ir_to_mesa.cpp