diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-02-23 13:56:15 -0800 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-03-01 17:00:20 -0800 |
commit | 074f5ba0b56b12ddaca81eac3d9ed19da7054297 (patch) | |
tree | a6f1236ecaa38a0d58d04908e4ef92f6098ce535 /src/compiler/nir/nir.h | |
parent | 86e749b1ad21fa8d8abea57b9b0ffa679166c472 (diff) |
nir: Add a simple int64 lowering pass
The algorithms used by this pass, especially for division, are heavily
based on the work Ian Romanick did for the similar int64 lowering pass
in the GLSL compiler.
v2: Properly handle vectors
v3: Get rid of log2_denom stuff. Since we're using bcsel, we do all the
calculations anyway and this is just extra instructions.
v4:
- Add back in the log2_denom stuff since it's needed for ensuring that
the shifts don't overflow.
- Rework the looping part of the pass to be easier to expand.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/compiler/nir/nir.h')
-rw-r--r-- | src/compiler/nir/nir.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 5243a9e58e..dd1e407785 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2540,6 +2540,15 @@ void nir_lower_to_source_mods(nir_shader *shader); bool nir_lower_gs_intrinsics(nir_shader *shader); typedef enum { + nir_lower_imul64 = (1 << 0), + nir_lower_isign64 = (1 << 1), + /** Lower all int64 modulus and division opcodes */ + nir_lower_divmod64 = (1 << 2), +} nir_lower_int64_options; + +bool nir_lower_int64(nir_shader *shader, nir_lower_int64_options options); + +typedef enum { nir_lower_drcp = (1 << 0), nir_lower_dsqrt = (1 << 1), nir_lower_drsq = (1 << 2), |