[Beignet] [PATCH 1/2] remove some redundant code for printf
Yan Wang
yan.wang at linux.intel.com
Wed Nov 30 06:21:37 UTC 2016
LGTM.
Thanks.
Yan Wang
On Mon, 2016-11-21 at 18:16 +0800, Guo, Yejun wrote:
> tmp0 is added into src in selection stage, and just ignored at
> context
> stage, it is redundant.
>
> Signed-off-by: Guo, Yejun <yejun.guo at intel.com>
> ---
> backend/src/backend/gen_context.cpp | 2 --
> backend/src/backend/gen_insn_selection.cpp | 54 +++++++++-----------
> ----------
> 2 files changed, 15 insertions(+), 41 deletions(-)
>
> diff --git a/backend/src/backend/gen_context.cpp
> b/backend/src/backend/gen_context.cpp
> index c38b7af..186c8d9 100644
> --- a/backend/src/backend/gen_context.cpp
> +++ b/backend/src/backend/gen_context.cpp
> @@ -3474,8 +3474,6 @@ namespace gbe
> const GenRegister tmp1 = ra->genReg(insn.dst(2));
> GenRegister src;
> uint32_t srcNum = insn.srcNum;
> - if (insn.extra.continueFlag)
> - srcNum--;
>
> GenRegister addr = GenRegister::retype(tmp0, GEN_TYPE_UD);
> GenRegister data = GenRegister::retype(tmp1, GEN_TYPE_UD);
> diff --git a/backend/src/backend/gen_insn_selection.cpp
> b/backend/src/backend/gen_insn_selection.cpp
> index c14e0bc..1808c7b 100644
> --- a/backend/src/backend/gen_insn_selection.cpp
> +++ b/backend/src/backend/gen_insn_selection.cpp
> @@ -2131,49 +2131,25 @@ namespace gbe
>
> void Selection::Opaque::PRINTF(GenRegister dst, uint8_t bti,
> GenRegister tmp0, GenRegister tmp1,
> GenRegister src[8], int srcNum, uint16_t num, bool
> isContinue, uint32_t totalSize) {
> - if (isContinue) {
> - SelectionInstruction *insn = this->appendInsn(SEL_OP_PRINTF,
> 3, srcNum + 1);
> - SelectionVector *vector = this->appendVector();
> -
> - for (int i = 0; i < srcNum; i++)
> - insn->src(i) = src[i];
> -
> - insn->src(srcNum) = tmp0;
> -
> - insn->dst(0) = dst;
> - insn->dst(1) = tmp0;
> - insn->dst(2) = tmp1;
> -
> - vector->regNum = 2;
> - vector->reg = &insn->dst(1);
> - vector->offsetID = 0;
> - vector->isSrc = 0;
> -
> - insn->extra.printfSize = static_cast<uint16_t>(totalSize);
> - insn->extra.continueFlag = isContinue;
> - insn->extra.printfBTI = bti;
> - insn->extra.printfNum = num;
> - } else {
> - SelectionInstruction *insn = this->appendInsn(SEL_OP_PRINTF,
> 3, srcNum);
> - SelectionVector *vector = this->appendVector();
> + SelectionInstruction *insn = this->appendInsn(SEL_OP_PRINTF, 3,
> srcNum);
> + SelectionVector *vector = this->appendVector();
>
> - for (int i = 0; i < srcNum; i++)
> - insn->src(i) = src[i];
> + for (int i = 0; i < srcNum; i++)
> + insn->src(i) = src[i];
>
> - insn->dst(0) = dst;
> - insn->dst(1) = tmp0;
> - insn->dst(2) = tmp1;
> + insn->dst(0) = dst;
> + insn->dst(1) = tmp0;
> + insn->dst(2) = tmp1;
>
> - vector->regNum = 2;
> - vector->reg = &insn->dst(1);
> - vector->offsetID = 0;
> - vector->isSrc = 0;
> + vector->regNum = 2;
> + vector->reg = &insn->dst(1);
> + vector->offsetID = 0;
> + vector->isSrc = 0;
>
> - insn->extra.printfSize = static_cast<uint16_t>(totalSize);
> - insn->extra.continueFlag = isContinue;
> - insn->extra.printfBTI = bti;
> - insn->extra.printfNum = num;
> - }
> + insn->extra.printfSize = static_cast<uint16_t>(totalSize);
> + insn->extra.continueFlag = isContinue;
> + insn->extra.printfBTI = bti;
> + insn->extra.printfNum = num;
> }
>
> void Selection::Opaque::WORKGROUP_OP(uint32_t wg_op,
More information about the Beignet
mailing list