summaryrefslogtreecommitdiffstats
path: root/src/intel/common/gen_mi_builder.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-04-03 14:59:20 -0500
committerJason Ekstrand <[email protected]>2019-04-11 18:04:09 +0000
commit316a98dec99ff1cfb848b0220141a47d52bcd24c (patch)
tree7837ed204f27090602a5ef8525fd154ac6f5e2bc /src/intel/common/gen_mi_builder.h
parent0d6dea0ac87ec3ca089c4ab637fd07a2f488e6a1 (diff)
intel/common: Support bigger right-shifts with mi_builder
Because why not?
Diffstat (limited to 'src/intel/common/gen_mi_builder.h')
-rw-r--r--src/intel/common/gen_mi_builder.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/intel/common/gen_mi_builder.h b/src/intel/common/gen_mi_builder.h
index 22c0aee3343..a67126930d6 100644
--- a/src/intel/common/gen_mi_builder.h
+++ b/src/intel/common/gen_mi_builder.h
@@ -689,6 +689,18 @@ gen_mi_ushr32_imm(struct gen_mi_builder *b,
/* We right-shift by left-shifting by 32 - shift and taking the top 32 bits
* of the result. This assumes the top 32 bits are zero.
*/
+ if (shift > 64)
+ return gen_mi_imm(0);
+
+ if (shift > 32) {
+ struct gen_mi_value tmp = gen_mi_new_gpr(b);
+ _gen_mi_copy_no_unref(b, gen_mi_value_half(tmp, false),
+ gen_mi_value_half(src, true));
+ _gen_mi_copy_no_unref(b, gen_mi_value_half(tmp, true), gen_mi_imm(0));
+ gen_mi_value_unref(b, src);
+ src = tmp;
+ shift -= 32;
+ }
assert(shift <= 32);
struct gen_mi_value tmp = gen_mi_ishl_imm(b, src, 32 - shift);
struct gen_mi_value dst = gen_mi_new_gpr(b);