From: Caio Marcelo de Oliveira Filho Date: Fri, 3 May 2019 21:34:55 +0000 (-0700) Subject: nir: Add nir_address_format_32bit_offset X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6bc9cdb1b70cadd628e441cec63b82152c93980e;p=mesa.git nir: Add nir_address_format_32bit_offset This is a simple 32-bit address which is not a global address. Gives us a format that don't use 0 as its null pointer value. We will need this in anv to represent nir_var_mem_shared addresses. Reviewed-by: Jason Ekstrand Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 5897f6cea7c..3d46250eade 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3113,6 +3113,11 @@ typedef enum { */ nir_address_format_32bit_index_offset, + /** + * An address format which is a simple 32-bit offset. + */ + nir_address_format_32bit_offset, + /** * An address format representing a purely logical addressing model. In * this model, all deref chains must be complete from the dereference @@ -3131,6 +3136,7 @@ nir_address_format_bit_size(nir_address_format addr_format) case nir_address_format_64bit_global: return 64; case nir_address_format_64bit_bounded_global: return 32; case nir_address_format_32bit_index_offset: return 32; + case nir_address_format_32bit_offset: return 32; case nir_address_format_logical: return 32; } unreachable("Invalid address format"); @@ -3144,6 +3150,7 @@ nir_address_format_num_components(nir_address_format addr_format) case nir_address_format_64bit_global: return 1; case nir_address_format_64bit_bounded_global: return 4; case nir_address_format_32bit_index_offset: return 2; + case nir_address_format_32bit_offset: return 1; case nir_address_format_logical: return 1; } unreachable("Invalid address format"); diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 1a7e00bf96a..153cd931f26 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -604,6 +604,7 @@ build_addr_iadd(nir_builder *b, nir_ssa_def *addr, switch (addr_format) { case nir_address_format_32bit_global: case nir_address_format_64bit_global: + case nir_address_format_32bit_offset: assert(addr->num_components == 1); return nir_iadd(b, addr, offset); @@ -675,6 +676,7 @@ addr_to_global(nir_builder *b, nir_ssa_def *addr, nir_u2u64(b, nir_channel(b, addr, 3))); case nir_address_format_32bit_index_offset: + case nir_address_format_32bit_offset: case nir_address_format_logical: unreachable("Cannot get a 64-bit address with this address format"); }