nir/glsl: Add another way of doing lower_imul64 for gen8+

On Gen 8 and 9, "mul" instruction supports 64 bit destination type. We
can reduce our 64x64 int multiplication from 4 instructions to 3.

Also instead of emitting two mul instructions, we can emit single mul
instuction and extract low/high 32 bits from 64 bit result for
[i/u]mulExtended

v2: 1) Allow lower_mul_high64 to use new opcode (Jason Ekstrand)
    2) Add lower_mul_2x32_64 flag (Matt Turner)
    3) Remove associative property as bit size is different (Connor
       Abbott)

v3: Fix indentation and variable naming convention (Jason Ekstrand)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Sagar Ghuge
2019-02-14 23:08:39 -08:00
parent 1d363d440f
commit e551040c60
6 changed files with 47 additions and 6 deletions

View File

@@ -2118,6 +2118,7 @@ typedef enum {
nir_lower_logic64 = (1 << 9),
nir_lower_minmax64 = (1 << 10),
nir_lower_shift64 = (1 << 11),
nir_lower_imul_2x32_64 = (1 << 12),
} nir_lower_int64_options;
typedef enum {
@@ -2259,6 +2260,9 @@ typedef struct nir_shader_compiler_options {
*/
bool use_interpolated_input_intrinsics;
/* Lowers when 32x32->64 bit multiplication is not supported */
bool lower_mul_2x32_64;
unsigned max_unroll_iterations;
nir_lower_int64_options lower_int64_options;