backend: improve add zero pattern

Submitted by rander on June 23, 2017, 7:36 a.m.

Details

Message ID 1498203398-19926-1-git-send-email-rander.wang@intel.com
State New
Series "backend: improve add zero pattern"
Headers show

Commit Message

rander June 23, 2017, 7:36 a.m.
remove the negation check for adding zero.
	it also can be applied this optimization

Signed-off-by: rander.wang <rander.wang@intel.com>
---
 backend/src/backend/gen_insn_selection_optimize.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/backend/src/backend/gen_insn_selection_optimize.cpp b/backend/src/backend/gen_insn_selection_optimize.cpp
index 1020b7f..3b76817 100644
--- a/backend/src/backend/gen_insn_selection_optimize.cpp
+++ b/backend/src/backend/gen_insn_selection_optimize.cpp
@@ -307,8 +307,8 @@  namespace gbe
     if (insn.opcode == SEL_OP_ADD) {
       GenRegister src0 = insn.src(0);
       GenRegister src1 = insn.src(1);
-      if ((src0.negation && src1.file == GEN_IMMEDIATE_VALUE && src1.value.f == 0.0f) ||
-          (src1.negation && src0.file == GEN_IMMEDIATE_VALUE && src0.value.f == 0.0f))
+      if ((src1.file == GEN_IMMEDIATE_VALUE && src1.value.f == 0.0f) ||
+          (src0.file == GEN_IMMEDIATE_VALUE && src0.value.f == 0.0f))
         addToReplaceInfoMap(insn);
     }
   }

Comments

Yang, Rong R July 3, 2017, 11:14 p.m.
After remove negation check, the function name doNegAddOptimization is not suitable.
Can you also change function name and the comment?

> -----Original Message-----

> From: Beignet [mailto:beignet-bounces@lists.freedesktop.org] On Behalf Of

> rander.wang

> Sent: Friday, June 23, 2017 15:37

> To: beignet@freedesktop.org

> Cc: Wang, Rander <rander.wang@intel.com>

> Subject: [Beignet] [PATCH] backend: improve add zero pattern

> 

> 	remove the negation check for adding zero.

> 	it also can be applied this optimization

> 

> Signed-off-by: rander.wang <rander.wang@intel.com>

> ---

>  backend/src/backend/gen_insn_selection_optimize.cpp | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/backend/src/backend/gen_insn_selection_optimize.cpp

> b/backend/src/backend/gen_insn_selection_optimize.cpp

> index 1020b7f..3b76817 100644

> --- a/backend/src/backend/gen_insn_selection_optimize.cpp

> +++ b/backend/src/backend/gen_insn_selection_optimize.cpp

> @@ -307,8 +307,8 @@ namespace gbe

>      if (insn.opcode == SEL_OP_ADD) {

>        GenRegister src0 = insn.src(0);

>        GenRegister src1 = insn.src(1);

> -      if ((src0.negation && src1.file == GEN_IMMEDIATE_VALUE &&

> src1.value.f == 0.0f) ||

> -          (src1.negation && src0.file == GEN_IMMEDIATE_VALUE && src0.value.f

> == 0.0f))

> +      if ((src1.file == GEN_IMMEDIATE_VALUE && src1.value.f == 0.0f) ||

> +          (src0.file == GEN_IMMEDIATE_VALUE && src0.value.f == 0.0f))

>          addToReplaceInfoMap(insn);

>      }

>    }

> --

> 2.7.4

> 

> _______________________________________________

> Beignet mailing list

> Beignet@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/beignet