From 74492ebad9457679eb25d1a1159a674a988731d5 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 28 Dec 2017 13:06:28 -0800 Subject: nir: Add a pass for lowering integer division by constants It's a reasonably well-known fact in the world of compilers that integer divisions by constants can be replaced by a multiply, an add, and some shifts. This commit adds such an optimization to NIR for easiest case of udiv. Other division operations will be added in following commits. In order to provide some additional driver control, the pass takes a minimum bit size to optimize. Reviewed-by: Ian Romanick ian.d.romanick@intel.com --- src/compiler/Makefile.sources | 1 + 1 file changed, 1 insertion(+) (limited to 'src/compiler/Makefile.sources') diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index ae170f02e82..53c6da45c1e 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -279,6 +279,7 @@ NIR_FILES = \ nir/nir_opt_find_array_copies.c \ nir/nir_opt_gcm.c \ nir/nir_opt_global_to_local.c \ + nir/nir_opt_idiv_const.c \ nir/nir_opt_if.c \ nir/nir_opt_intrinsics.c \ nir/nir_opt_loop_unroll.c \ -- cgit v1.2.3