From f9cdbf44054009122fcc16c887fb90ccc33b52c9 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 5 Apr 2016 12:39:47 -0400 Subject: freedreno/ir3: eliminate unnecessary absneg's The frontend inserts (abs) and (neg)'s to convert between NIR boolean (~0/0) and native boolean (1/0). So we'd end up with things like: cmps.s.ge r1.x, ... absneg.s r1.x, (neg)r1.x absneg.s r1.x, (abs)r1.x sel.b32 r2.x, r0.x, r1.x, r0.y The (neg) already gets collapsed due to the following (abs). Now by realizing that r1.x comes from a cmps.s instruction, we can drop the (abs) as well. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/ir3/ir3.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/gallium/drivers/freedreno/ir3/ir3.h') diff --git a/src/gallium/drivers/freedreno/ir3/ir3.h b/src/gallium/drivers/freedreno/ir3/ir3.h index 23e43b1e13d..3859f6a39f3 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3.h +++ b/src/gallium/drivers/freedreno/ir3/ir3.h @@ -628,6 +628,18 @@ static inline bool is_input(struct ir3_instruction *instr) } } +static inline bool is_bool(struct ir3_instruction *instr) +{ + switch (instr->opc) { + case OPC_CMPS_F: + case OPC_CMPS_S: + case OPC_CMPS_U: + return true; + default: + return false; + } +} + static inline bool is_meta(struct ir3_instruction *instr) { /* TODO how should we count PHI (and maybe fan-in/out) which -- cgit v1.2.3