diff options
author | Rob Clark <[email protected]> | 2015-04-12 09:46:34 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-04-17 10:40:28 -0400 |
commit | 87807e5cc50f404a8e3ec8864bf8b7427ab6d687 (patch) | |
tree | 1ae857183f309cdb4b14a29192c06d27c1d28a65 | |
parent | 70b2f872ea6ae651b832a2b3dd975efd78289fad (diff) |
freedreno/ir3: move out helper
We'll also want it in NIR f/e for implementing UBO support.
Signed-off-by: Rob Clark <[email protected]>
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3.h | 23 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_cp.c | 24 |
2 files changed, 23 insertions, 24 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.h b/src/gallium/drivers/freedreno/ir3/ir3.h index 85daf106535..1a3deb41e01 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3.h +++ b/src/gallium/drivers/freedreno/ir3/ir3.h @@ -458,6 +458,29 @@ static inline bool is_nop(struct ir3_instruction *instr) return is_flow(instr) && (instr->opc == OPC_NOP); } +/* Is it a non-transformative (ie. not type changing) mov? This can + * also include absneg.s/absneg.f, which for the most part can be + * treated as a mov (single src argument). + */ +static inline bool is_same_type_mov(struct ir3_instruction *instr) +{ + struct ir3_register *dst = instr->regs[0]; + + /* mov's that write to a0.x or p0.x are special: */ + if (dst->num == regid(REG_P0, 0)) + return false; + if (dst->num == regid(REG_A0, 0)) + return false; + + if ((instr->category == 1) && + (instr->cat1.src_type == instr->cat1.dst_type)) + return true; + if ((instr->category == 2) && ((instr->opc == OPC_ABSNEG_F) || + (instr->opc == OPC_ABSNEG_S))) + return true; + return false; +} + static inline bool is_alu(struct ir3_instruction *instr) { return (1 <= instr->category) && (instr->category <= 3); diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cp.c b/src/gallium/drivers/freedreno/ir3/ir3_cp.c index 313a423b7cb..fa7d363be7b 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_cp.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_cp.c @@ -34,30 +34,6 @@ * Copy Propagate: */ - -/* Is it a non-transformative (ie. not type changing) mov? This can - * also include absneg.s/absneg.f, which for the most part can be - * treated as a mov (single src argument). - */ -static bool is_same_type_mov(struct ir3_instruction *instr) -{ - struct ir3_register *dst = instr->regs[0]; - - /* mov's that write to a0.x or p0.x are special: */ - if (dst->num == regid(REG_P0, 0)) - return false; - if (dst->num == regid(REG_A0, 0)) - return false; - - if ((instr->category == 1) && - (instr->cat1.src_type == instr->cat1.dst_type)) - return true; - if ((instr->category == 2) && ((instr->opc == OPC_ABSNEG_F) || - (instr->opc == OPC_ABSNEG_S))) - return true; - return false; -} - /* is it a type preserving mov, with ok flags? */ static bool is_eligible_mov(struct ir3_instruction *instr, bool allow_flags) { |