All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tobias Klausmann <tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
To: Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
Cc: "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 3/4] nvc0/ir: optimize set & 1.0 to produce boolean-float sets
Date: Sat, 9 May 2015 21:47:04 +0200	[thread overview]
Message-ID: <554E6438.9080001@mni.thm.de> (raw)
In-Reply-To: <CAKb7Uvg-2tUxSpkXVh9M+a6G2bTO97MzowN=r0jRbYh5DiFmYw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>



On 09.05.2015 19:53, Ilia Mirkin wrote:
> On Sat, May 9, 2015 at 11:27 AM, Tobias Klausmann
> <tobias.johannes.klausmann@mni.thm.de> wrote:
>>
>> On 09.05.2015 07:35, Ilia Mirkin wrote:
>>> This has started to happen more now that the backend is producing
>>> KILL_IF more often.
>>>
>>> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
>>> ---
>>>    .../drivers/nouveau/codegen/nv50_ir_peephole.cpp   | 29
>>> ++++++++++++++++++++++
>>>    .../nouveau/codegen/nv50_ir_target_nv50.cpp        |  2 ++
>>>    2 files changed, 31 insertions(+)
>>>
>>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> index 14446b6..d8af19a 100644
>>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>>> @@ -973,6 +973,35 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue
>>> &imm0, int s)
>>>       }
>>>          break;
>>>    +   case OP_AND:
>>> +   {
>>> +      CmpInstruction *cmp = i->getSrc(t)->getInsn()->asCmp();
>>> +      if (!cmp || cmp->op == OP_SLCT)
>>
>> how about if (cmp == NULL || ...) and kill the same condition later?
> I just killed the other one. I think the usual style tends to be if
> (!ptr) rather than if (ptr == NULL) in codegen. Both are acceptable
> though.

it was mainly about the dead code you killed now. With this it looks 
fine to me, so feel free to add

Reviewed-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>


>>
>>> +         return;
>>> +      if (!prog->getTarget()->isOpSupported(cmp->op, TYPE_F32))
>>> +         return;
>>> +      if (imm0.reg.data.f32 != 1.0)
>>> +         return;
>>> +      if (cmp == NULL)
>>> +         return;
>>> +      if (i->getSrc(t)->getInsn()->dType != TYPE_U32)
>>> +         return;
>>> +
>>> +      i->getSrc(t)->getInsn()->dType = TYPE_F32;
>>> +      if (i->src(t).mod != Modifier(0)) {
>>> +         assert(i->src(t).mod == Modifier(NV50_IR_MOD_NOT));
>>> +         i->src(t).mod = Modifier(0);
>>> +         cmp->setCond = reverseCondCode(cmp->setCond);
>>> +      }
>>> +      i->op = OP_MOV;
>>> +      i->setSrc(s, NULL);
>>> +      if (t) {
>>> +         i->setSrc(0, i->getSrc(t));
>>> +         i->setSrc(t, NULL);
>>> +      }
>>> +   }
>>> +      break;
>>> +
>>>       case OP_SHL:
>>>       {
>>>          if (s != 1 || i->src(0).mod != Modifier(0))
>>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
>>> b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
>>> index 178a167..70180eb 100644
>>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
>>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
>>> @@ -413,6 +413,8 @@ TargetNV50::isOpSupported(operation op, DataType ty)
>>> const
>>>          return false;
>>>       case OP_SAD:
>>>          return ty == TYPE_S32;
>>> +   case OP_SET:
>>> +      return !isFloatType(ty);
>>>       default:
>>>          return true;
>>>       }
>>

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2015-05-09 19:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-09  5:35 [PATCH 1/4] nvc0/ir: avoid jumping to a sched instruction Ilia Mirkin
     [not found] ` <1431149707-7159-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-05-09  5:35   ` [PATCH 2/4] nvc0/ir: allow iset to produce a boolean float Ilia Mirkin
2015-05-09  5:35   ` [PATCH 3/4] nvc0/ir: optimize set & 1.0 to produce boolean-float sets Ilia Mirkin
     [not found]     ` <1431149707-7159-3-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-05-09 15:27       ` Tobias Klausmann
     [not found]         ` <554E2754.5080904-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-05-09 17:53           ` Ilia Mirkin
     [not found]             ` <CAKb7Uvg-2tUxSpkXVh9M+a6G2bTO97MzowN=r0jRbYh5DiFmYw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-09 19:47               ` Tobias Klausmann [this message]
2015-05-09  5:35 ` [PATCH 4/4] nv50/ir: allow OP_SET to merge with OP_SET_AND/etc as well as a neg Ilia Mirkin
     [not found]   ` <1431149707-7159-4-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-05-09 20:04     ` Tobias Klausmann
     [not found]       ` <554E685B.1040602-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-05-09 20:07         ` Ilia Mirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=554E6438.9080001@mni.thm.de \
    --to=tobias.johannes.klausmann-aqjdnwhu20eelga04laivw@public.gmane.org \
    --cc=imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.