projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9b35fab
)
nir/builder: Add a nir_imm_intN_t helper
author
Jason Ekstrand
<jason.ekstrand@intel.com>
Tue, 31 Oct 2017 21:42:33 +0000
(14:42 -0700)
committer
Jason Ekstrand
<jason.ekstrand@intel.com>
Tue, 7 Nov 2017 18:37:52 +0000
(10:37 -0800)
This lets you easily build integer immediates of arbitrary bit size.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/compiler/nir/nir_builder.h
patch
|
blob
|
history
diff --git
a/src/compiler/nir/nir_builder.h
b/src/compiler/nir/nir_builder.h
index 4bd5628ff7d42929e7066325fe8dd746ca0bbb08..36e0ae3ac6359b84abb05ca5013593500dc64e1f 100644
(file)
--- a/
src/compiler/nir/nir_builder.h
+++ b/
src/compiler/nir/nir_builder.h
@@
-263,6
+263,18
@@
nir_imm_int64(nir_builder *build, int64_t x)
return nir_build_imm(build, 1, 64, v);
}
+static inline nir_ssa_def *
+nir_imm_intN_t(nir_builder *build, uint64_t x, unsigned bit_size)
+{
+ nir_const_value v;
+
+ memset(&v, 0, sizeof(v));
+ assert(bit_size <= 64);
+ v.i64[0] = x & (~0ull >> (64 - bit_size));
+
+ return nir_build_imm(build, 1, bit_size, v);
+}
+
static inline nir_ssa_def *
nir_imm_ivec4(nir_builder *build, int x, int y, int z, int w)
{