nir: Add a lower_fdiv option, turn fdiv into fmul/frcp.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 5 Jan 2016 13:09:46 +0000 (05:09 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 6 Jan 2016 03:22:11 +0000 (19:22 -0800)
commit7295f4fcc2b2dd1bc6a8d1d834774b8152a029cf
tree948332ade1aa90a7ed959f4d5e44edeaa8cfbf0b
parentbd21b54607615605b6335282029687bb0885f4ad
nir: Add a lower_fdiv option, turn fdiv into fmul/frcp.

The nir_opt_algebraic rule

(('fadd', ('flog2', a), ('fneg', ('flog2', b))), ('flog2', ('fdiv', a, b))),

can produce new fdiv operations, which need to be lowered on i965,
as we don't actually implement fdiv.  (Normally, we handle this in
GLSL IR's lower_instructions pass, but in the above case we introduce
an fdiv after that point.  So, make NIR do it for us.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
src/glsl/nir/nir.h
src/glsl/nir/nir_opt_algebraic.py
src/mesa/drivers/dri/i965/brw_shader.cpp