summaryrefslogtreecommitdiffstats
path: root/src/intel/compiler
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2018-06-25 12:06:50 -0700
committerFrancisco Jerez <[email protected]>2018-07-09 23:46:57 -0700
commit20b962232b71c8f5931ddb585386725804dbd4e0 (patch)
treed50a1aefc9a90b380f7a7572795c88eff7ceacc0 /src/intel/compiler
parentd0f589a55b51242f80c299187511db7f1b041712 (diff)
intel/eu: Define SET_BITS helper more easily reusable than SET_FIELD.
Allows to specify a bitfield based on its upper and lower bounds instead of a symbolic field definition, kind of what the current GET_BITS macro is to GET_FIELD. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel/compiler')
-rw-r--r--src/intel/compiler/brw_eu_defines.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/intel/compiler/brw_eu_defines.h b/src/intel/compiler/brw_eu_defines.h
index f6d771d1534..fb8caa60715 100644
--- a/src/intel/compiler/brw_eu_defines.h
+++ b/src/intel/compiler/brw_eu_defines.h
@@ -46,6 +46,13 @@
fieldval & field ## _MASK; \
})
+#define SET_BITS(value, high, low) \
+ ({ \
+ const uint32_t fieldval = (value) << (low); \
+ assert((fieldval & ~INTEL_MASK(high, low)) == 0); \
+ fieldval & INTEL_MASK(high, low); \
+ })
+
#define GET_BITS(data, high, low) ((data & INTEL_MASK((high), (low))) >> (low))
#define GET_FIELD(word, field) (((word) & field ## _MASK) >> field ## _SHIFT)