summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_lower_alu_to_scalar.c3
-rw-r--r--src/compiler/nir/nir_lower_double_ops.c22
-rw-r--r--src/compiler/nir/nir_lower_double_packing.c46
-rw-r--r--src/compiler/nir/nir_opcodes.py21
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py2
5 files changed, 30 insertions, 64 deletions
diff --git a/src/compiler/nir/nir_lower_alu_to_scalar.c b/src/compiler/nir/nir_lower_alu_to_scalar.c
index 8a967c56831..080d980f347 100644
--- a/src/compiler/nir/nir_lower_alu_to_scalar.c
+++ b/src/compiler/nir/nir_lower_alu_to_scalar.c
@@ -188,8 +188,7 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
return true;
}
- case nir_op_unpack_double_2x32:
- case nir_op_unpack_int_2x32:
+ case nir_op_unpack_64_2x32:
return false;
LOWER_REDUCTION(nir_op_fdot, nir_op_fmul, nir_op_fadd);
diff --git a/src/compiler/nir/nir_lower_double_ops.c b/src/compiler/nir/nir_lower_double_ops.c
index fdd0f447448..ad9631327b4 100644
--- a/src/compiler/nir/nir_lower_double_ops.c
+++ b/src/compiler/nir/nir_lower_double_ops.c
@@ -41,22 +41,22 @@ static nir_ssa_def *
set_exponent(nir_builder *b, nir_ssa_def *src, nir_ssa_def *exp)
{
/* Split into bits 0-31 and 32-63 */
- nir_ssa_def *lo = nir_unpack_double_2x32_split_x(b, src);
- nir_ssa_def *hi = nir_unpack_double_2x32_split_y(b, src);
+ nir_ssa_def *lo = nir_unpack_64_2x32_split_x(b, src);
+ nir_ssa_def *hi = nir_unpack_64_2x32_split_y(b, src);
/* The exponent is bits 52-62, or 20-30 of the high word, so set the exponent
* to 1023
*/
nir_ssa_def *new_hi = nir_bfi(b, nir_imm_int(b, 0x7ff00000), exp, hi);
/* recombine */
- return nir_pack_double_2x32_split(b, lo, new_hi);
+ return nir_pack_64_2x32_split(b, lo, new_hi);
}
static nir_ssa_def *
get_exponent(nir_builder *b, nir_ssa_def *src)
{
/* get bits 32-63 */
- nir_ssa_def *hi = nir_unpack_double_2x32_split_y(b, src);
+ nir_ssa_def *hi = nir_unpack_64_2x32_split_y(b, src);
/* extract bits 20-30 of the high word */
return nir_ubitfield_extract(b, hi, nir_imm_int(b, 20), nir_imm_int(b, 11));
@@ -67,7 +67,7 @@ get_exponent(nir_builder *b, nir_ssa_def *src)
static nir_ssa_def *
get_signed_inf(nir_builder *b, nir_ssa_def *zero)
{
- nir_ssa_def *zero_hi = nir_unpack_double_2x32_split_y(b, zero);
+ nir_ssa_def *zero_hi = nir_unpack_64_2x32_split_y(b, zero);
/* The bit pattern for infinity is 0x7ff0000000000000, where the sign bit
* is the highest bit. Only the sign bit can be non-zero in the passed in
@@ -76,7 +76,7 @@ get_signed_inf(nir_builder *b, nir_ssa_def *zero)
* bits and then pack it together with zero low 32 bits.
*/
nir_ssa_def *inf_hi = nir_ior(b, nir_imm_int(b, 0x7ff00000), zero_hi);
- return nir_pack_double_2x32_split(b, nir_imm_int(b, 0), inf_hi);
+ return nir_pack_64_2x32_split(b, nir_imm_int(b, 0), inf_hi);
}
/*
@@ -337,8 +337,8 @@ lower_trunc(nir_builder *b, nir_ssa_def *src)
nir_imm_int(b, ~0),
nir_isub(b, frac_bits, nir_imm_int(b, 32))));
- nir_ssa_def *src_lo = nir_unpack_double_2x32_split_x(b, src);
- nir_ssa_def *src_hi = nir_unpack_double_2x32_split_y(b, src);
+ nir_ssa_def *src_lo = nir_unpack_64_2x32_split_x(b, src);
+ nir_ssa_def *src_hi = nir_unpack_64_2x32_split_y(b, src);
return
nir_bcsel(b,
@@ -346,9 +346,9 @@ lower_trunc(nir_builder *b, nir_ssa_def *src)
nir_imm_double(b, 0.0),
nir_bcsel(b, nir_ige(b, unbiased_exp, nir_imm_int(b, 53)),
src,
- nir_pack_double_2x32_split(b,
- nir_iand(b, mask_lo, src_lo),
- nir_iand(b, mask_hi, src_hi))));
+ nir_pack_64_2x32_split(b,
+ nir_iand(b, mask_lo, src_lo),
+ nir_iand(b, mask_hi, src_hi))));
}
static nir_ssa_def *
diff --git a/src/compiler/nir/nir_lower_double_packing.c b/src/compiler/nir/nir_lower_double_packing.c
index 6bb01ff1909..61c4ea65eae 100644
--- a/src/compiler/nir/nir_lower_double_packing.c
+++ b/src/compiler/nir/nir_lower_double_packing.c
@@ -35,31 +35,17 @@
*/
static nir_ssa_def *
-lower_pack_double(nir_builder *b, nir_ssa_def *src)
+lower_pack_64(nir_builder *b, nir_ssa_def *src)
{
- return nir_pack_double_2x32_split(b, nir_channel(b, src, 0),
- nir_channel(b, src, 1));
+ return nir_pack_64_2x32_split(b, nir_channel(b, src, 0),
+ nir_channel(b, src, 1));
}
static nir_ssa_def *
-lower_unpack_double(nir_builder *b, nir_ssa_def *src)
+lower_unpack_64(nir_builder *b, nir_ssa_def *src)
{
- return nir_vec2(b, nir_unpack_double_2x32_split_x(b, src),
- nir_unpack_double_2x32_split_y(b, src));
-}
-
-static nir_ssa_def *
-lower_pack_int(nir_builder *b, nir_ssa_def *src)
-{
- return nir_pack_int_2x32_split(b, nir_channel(b, src, 0),
- nir_channel(b, src, 1));
-}
-
-static nir_ssa_def *
-lower_unpack_int(nir_builder *b, nir_ssa_def *src)
-{
- return nir_vec2(b, nir_unpack_int_2x32_split_x(b, src),
- nir_unpack_int_2x32_split_y(b, src));
+ return nir_vec2(b, nir_unpack_64_2x32_split_x(b, src),
+ nir_unpack_64_2x32_split_y(b, src));
}
static void
@@ -75,10 +61,8 @@ lower_double_pack_impl(nir_function_impl *impl)
nir_alu_instr *alu_instr = (nir_alu_instr *) instr;
- if (alu_instr->op != nir_op_pack_double_2x32 &&
- alu_instr->op != nir_op_unpack_double_2x32 &&
- alu_instr->op != nir_op_pack_int_2x32 &&
- alu_instr->op != nir_op_unpack_int_2x32)
+ if (alu_instr->op != nir_op_pack_64_2x32 &&
+ alu_instr->op != nir_op_unpack_64_2x32)
continue;
b.cursor = nir_before_instr(&alu_instr->instr);
@@ -87,17 +71,11 @@ lower_double_pack_impl(nir_function_impl *impl)
nir_ssa_def *dest;
switch (alu_instr->op) {
- case nir_op_pack_double_2x32:
- dest = lower_pack_double(&b, src);
- break;
- case nir_op_unpack_double_2x32:
- dest = lower_unpack_double(&b, src);
- break;
- case nir_op_pack_int_2x32:
- dest = lower_pack_int(&b, src);
+ case nir_op_pack_64_2x32:
+ dest = lower_pack_64(&b, src);
break;
- case nir_op_unpack_int_2x32:
- dest = lower_unpack_int(&b, src);
+ case nir_op_unpack_64_2x32:
+ dest = lower_unpack_64(&b, src);
break;
default:
unreachable("Impossible opcode");
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index ece673cda36..b116fcffcc7 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -285,16 +285,10 @@ dst.x = (src0.x << 0) |
(src0.w << 24);
""")
-unop_horiz("pack_double_2x32", 1, tuint64, 2, tuint32,
+unop_horiz("pack_64_2x32", 1, tuint64, 2, tuint32,
"dst.x = src0.x | ((uint64_t)src0.y << 32);")
-unop_horiz("pack_int_2x32", 1, tint64, 2, tint32,
- "dst.x = src0.x | ((int64_t)src0.y << 32);")
-
-unop_horiz("unpack_double_2x32", 2, tuint32, 1, tuint64,
- "dst.x = src0.x; dst.y = src0.x >> 32;")
-
-unop_horiz("unpack_int_2x32", 2, tint32, 1, tint64,
+unop_horiz("unpack_64_2x32", 2, tuint32, 1, tuint64,
"dst.x = src0.x; dst.y = src0.x >> 32;")
# Lowered floating point unpacking operations.
@@ -305,10 +299,8 @@ unop_horiz("unpack_half_2x16_split_x", 1, tfloat32, 1, tuint32,
unop_horiz("unpack_half_2x16_split_y", 1, tfloat32, 1, tuint32,
"unpack_half_1x16((uint16_t)(src0.x >> 16))")
-unop_convert("unpack_double_2x32_split_x", tuint32, tuint64, "src0")
-unop_convert("unpack_double_2x32_split_y", tuint32, tuint64, "src0 >> 32")
-unop_convert("unpack_int_2x32_split_x", tuint32, tuint64, "src0")
-unop_convert("unpack_int_2x32_split_y", tuint32, tuint64, "src0 >> 32")
+unop_convert("unpack_64_2x32_split_x", tuint32, tuint64, "src0")
+unop_convert("unpack_64_2x32_split_y", tuint32, tuint64, "src0 >> 32")
# Bit operations, part of ARB_gpu_shader5.
@@ -588,10 +580,7 @@ binop("fpow", tfloat, "", "bit_size == 64 ? powf(src0, src1) : pow(src0, src1)")
binop_horiz("pack_half_2x16_split", 1, tuint32, 1, tfloat32, 1, tfloat32,
"pack_half_1x16(src0.x) | (pack_half_1x16(src1.x) << 16)")
-binop_convert("pack_double_2x32_split", tuint64, tuint32, "",
- "src0 | ((uint64_t)src1 << 32)")
-
-binop_convert("pack_int_2x32_split", tuint64, tuint32, "",
+binop_convert("pack_64_2x32_split", tuint64, tuint32, "",
"src0 | ((uint64_t)src1 << 32)")
# bfm implements the behavior of the first operation of the SM5 "bfi" assembly
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index aaad45a4c5a..8a6dd073e9f 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -434,7 +434,7 @@ def fexp2i(exp, bits):
if bits == 32:
return ('ishl', ('iadd', exp, 127), 23)
elif bits == 64:
- return ('pack_double_2x32_split', 0, ('ishl', ('iadd', exp, 1023), 20))
+ return ('pack_64_2x32_split', 0, ('ishl', ('iadd', exp, 1023), 20))
else:
assert False