summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-06-20 23:22:02 -0400
committerJonathan Marek <[email protected]>2019-06-26 15:26:10 -0400
commita70ff70158a22003948f449343a55ad47ce73996 (patch)
tree8c63961a7b3efc65e8cc4203d9a42d83e306c2c3 /src
parent0b5a483baaefa9a7e39c76607d8f0f435aa46315 (diff)
nir: remove fnot/fxor/fand/for opcodes
There doesn't seem to be any reason to keep these opcodes around: * fnot/fxor are not used at all. * fand/for are only used in lower_alu_to_scalar, but easily replaced Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir.h1
-rw-r--r--src/compiler/nir/nir_lower_alu_to_scalar.c4
-rw-r--r--src/compiler/nir/nir_opcodes.py14
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py2
-rw-r--r--src/gallium/drivers/freedreno/a2xx/ir2_nir.c4
-rw-r--r--src/gallium/drivers/freedreno/a2xx/ir2_nir_lower_scalar.c4
-rw-r--r--src/gallium/drivers/lima/ir/gp/nir.c3
-rw-r--r--src/gallium/drivers/lima/ir/pp/nir.c4
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp8
9 files changed, 4 insertions, 40 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index bc9122d1f25..94995ec37da 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1674,7 +1674,6 @@ nir_alu_instr_is_comparison(const nir_alu_instr *instr)
case nir_op_i2b1:
case nir_op_f2b1:
case nir_op_inot:
- case nir_op_fnot:
return true;
default:
return false;
diff --git a/src/compiler/nir/nir_lower_alu_to_scalar.c b/src/compiler/nir/nir_lower_alu_to_scalar.c
index 71389c2f0c3..f46e15e17fd 100644
--- a/src/compiler/nir/nir_lower_alu_to_scalar.c
+++ b/src/compiler/nir/nir_lower_alu_to_scalar.c
@@ -209,8 +209,8 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b, BITSET_WORD *lower_
LOWER_REDUCTION(nir_op_b32all_iequal, nir_op_ieq32, nir_op_iand);
LOWER_REDUCTION(nir_op_b32any_fnequal, nir_op_fne32, nir_op_ior);
LOWER_REDUCTION(nir_op_b32any_inequal, nir_op_ine32, nir_op_ior);
- LOWER_REDUCTION(nir_op_fall_equal, nir_op_seq, nir_op_fand);
- LOWER_REDUCTION(nir_op_fany_nequal, nir_op_sne, nir_op_for);
+ LOWER_REDUCTION(nir_op_fall_equal, nir_op_seq, nir_op_fmin);
+ LOWER_REDUCTION(nir_op_fany_nequal, nir_op_sne, nir_op_fmax);
default:
break;
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index a12b0269e2e..26e26797585 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -190,8 +190,6 @@ unop("mov", tuint, "src0")
unop("ineg", tint, "-src0")
unop("fneg", tfloat, "-src0")
unop("inot", tint, "~src0") # invert every bit of the integer
-unop("fnot", tfloat, ("bit_size == 64 ? ((src0 == 0.0) ? 1.0 : 0.0f) : " +
- "((src0 == 0.0f) ? 1.0f : 0.0f)"))
unop("fsign", tfloat, ("bit_size == 64 ? " +
"((src0 == 0.0) ? 0.0 : ((src0 > 0.0) ? 1.0 : -1.0)) : " +
"((src0 == 0.0f) ? 0.0f : ((src0 > 0.0f) ? 1.0f : -1.0f))"))
@@ -700,18 +698,6 @@ binop("ior", tuint, _2src_commutative + associative, "src0 | src1")
binop("ixor", tuint, _2src_commutative + associative, "src0 ^ src1")
-# floating point logic operators
-#
-# These use (src != 0.0) for testing the truth of the input, and output 1.0
-# for true and 0.0 for false
-
-binop("fand", tfloat32, _2src_commutative,
- "((src0 != 0.0f) && (src1 != 0.0f)) ? 1.0f : 0.0f")
-binop("for", tfloat32, _2src_commutative,
- "((src0 != 0.0f) || (src1 != 0.0f)) ? 1.0f : 0.0f")
-binop("fxor", tfloat32, _2src_commutative,
- "(src0 != 0.0f && src1 == 0.0f) || (src0 == 0.0f && src1 != 0.0f) ? 1.0f : 0.0f")
-
binop_reduce("fdot", 1, tfloat, tfloat, "{src0} * {src1}", "{src0} + {src1}",
"{src}")
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 4147be9c1f7..45e8779e16e 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -554,14 +554,12 @@ optimizations = [
(('ult', a, a), False),
(('uge', a, a), True),
# Logical and bit operations
- (('fand', a, 0.0), 0.0),
(('iand', a, a), a),
(('iand', a, ~0), a),
(('iand', a, 0), 0),
(('ior', a, a), a),
(('ior', a, 0), a),
(('ior', a, True), True),
- (('fxor', a, a), 0.0),
(('ixor', a, a), 0),
(('ixor', a, 0), a),
(('inot', ('inot', a)), a),
diff --git a/src/gallium/drivers/freedreno/a2xx/ir2_nir.c b/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
index 36f3a679ff6..5becd522615 100644
--- a/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
+++ b/src/gallium/drivers/freedreno/a2xx/ir2_nir.c
@@ -286,10 +286,6 @@ instr_create_alu(struct ir2_context *ctx, nir_op opcode, unsigned ncomp)
[nir_op_mov] = {MAXs, MAXv},
[nir_op_fsign] = {-1, CNDGTEv},
- [nir_op_fnot] = {SETEs, SETEv},
- [nir_op_for] = {MAXs, MAXv},
- [nir_op_fand] = {MINs, MINv},
- [nir_op_fxor] = {-1, SETNEv},
[nir_op_fadd] = {ADDs, ADDv},
[nir_op_fsub] = {ADDs, ADDv},
[nir_op_fmul] = {MULs, MULv},
diff --git a/src/gallium/drivers/freedreno/a2xx/ir2_nir_lower_scalar.c b/src/gallium/drivers/freedreno/a2xx/ir2_nir_lower_scalar.c
index 2b72a86b3e1..1af211e759e 100644
--- a/src/gallium/drivers/freedreno/a2xx/ir2_nir_lower_scalar.c
+++ b/src/gallium/drivers/freedreno/a2xx/ir2_nir_lower_scalar.c
@@ -93,8 +93,8 @@ static bool lower_scalar(nir_alu_instr * instr, nir_builder * b)
switch (instr->op) {
/* TODO: handle these instead of lowering */
- LOWER_REDUCTION(nir_op_fall_equal, nir_op_seq, nir_op_fand);
- LOWER_REDUCTION(nir_op_fany_nequal, nir_op_sne, nir_op_for);
+ LOWER_REDUCTION(nir_op_fall_equal, nir_op_seq, nir_op_fmin);
+ LOWER_REDUCTION(nir_op_fany_nequal, nir_op_sne, nir_op_fmax);
default:
return false;
diff --git a/src/gallium/drivers/lima/ir/gp/nir.c b/src/gallium/drivers/lima/ir/gp/nir.c
index 49010d3c255..902d27a3149 100644
--- a/src/gallium/drivers/lima/ir/gp/nir.c
+++ b/src/gallium/drivers/lima/ir/gp/nir.c
@@ -114,7 +114,6 @@ static int nir_to_gpir_opcodes[nir_num_opcodes] = {
[nir_op_fmul] = gpir_op_mul,
[nir_op_fadd] = gpir_op_add,
[nir_op_fneg] = gpir_op_neg,
- [nir_op_fnot] = gpir_op_not,
[nir_op_fmin] = gpir_op_min,
[nir_op_fmax] = gpir_op_max,
[nir_op_frcp] = gpir_op_rcp,
@@ -126,8 +125,6 @@ static int nir_to_gpir_opcodes[nir_num_opcodes] = {
[nir_op_fsign] = gpir_op_sign,
[nir_op_seq] = gpir_op_eq,
[nir_op_sne] = gpir_op_ne,
- [nir_op_fand] = gpir_op_min,
- [nir_op_for] = gpir_op_max,
[nir_op_fabs] = gpir_op_abs,
[nir_op_mov] = gpir_op_mov,
};
diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c
index 907cb1105d2..55d96191910 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -137,9 +137,6 @@ static int nir_to_ppir_opcodes[nir_num_opcodes] = {
[nir_op_ffloor] = ppir_op_floor,
[nir_op_fceil] = ppir_op_ceil,
[nir_op_ffract] = ppir_op_fract,
- [nir_op_fand] = ppir_op_and,
- [nir_op_for] = ppir_op_or,
- [nir_op_fxor] = ppir_op_xor,
[nir_op_sge] = ppir_op_ge,
[nir_op_fge] = ppir_op_ge,
[nir_op_slt] = ppir_op_lt,
@@ -148,7 +145,6 @@ static int nir_to_ppir_opcodes[nir_num_opcodes] = {
[nir_op_feq] = ppir_op_eq,
[nir_op_sne] = ppir_op_ne,
[nir_op_fne] = ppir_op_ne,
- [nir_op_fnot] = ppir_op_not,
[nir_op_fcsel] = ppir_op_select,
[nir_op_inot] = ppir_op_not,
[nir_op_ftrunc] = ppir_op_trunc,
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
index a9089ea7b59..13990567987 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -348,7 +348,6 @@ Converter::getOperation(nir_op op)
case nir_op_fadd:
case nir_op_iadd:
return OP_ADD;
- case nir_op_fand:
case nir_op_iand:
return OP_AND;
case nir_op_ifind_msb:
@@ -417,10 +416,8 @@ Converter::getOperation(nir_op op)
case nir_op_fneg:
case nir_op_ineg:
return OP_NEG;
- case nir_op_fnot:
case nir_op_inot:
return OP_NOT;
- case nir_op_for:
case nir_op_ior:
return OP_OR;
case nir_op_fpow:
@@ -456,7 +453,6 @@ Converter::getOperation(nir_op op)
return OP_SUB;
case nir_op_ftrunc:
return OP_TRUNC;
- case nir_op_fxor:
case nir_op_ixor:
return OP_XOR;
default:
@@ -2705,7 +2701,6 @@ Converter::visit(nir_alu_instr *insn)
case nir_op_iabs:
case nir_op_fadd:
case nir_op_iadd:
- case nir_op_fand:
case nir_op_iand:
case nir_op_fceil:
case nir_op_fcos:
@@ -2737,9 +2732,7 @@ Converter::visit(nir_alu_instr *insn)
case nir_op_umul_high:
case nir_op_fneg:
case nir_op_ineg:
- case nir_op_fnot:
case nir_op_inot:
- case nir_op_for:
case nir_op_ior:
case nir_op_pack_64_2x32_split:
case nir_op_fpow:
@@ -2756,7 +2749,6 @@ Converter::visit(nir_alu_instr *insn)
case nir_op_isub:
case nir_op_ftrunc:
case nir_op_ishl:
- case nir_op_fxor:
case nir_op_ixor: {
DEFAULT_CHECKS;
LValues &newDefs = convert(&insn->dest);