All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: Richard Henderson <rth@twiddle.net>,
	kraxel@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 03/14] cg3: remove unused width and height variables
Date: Tue, 18 Apr 2017 15:38:10 +0100	[thread overview]
Message-ID: <03d1cb2e-7b0d-7ae1-a884-413cf388762e@ilande.co.uk> (raw)
In-Reply-To: <f56ec3d4-236e-2082-db5a-8402eb050503@twiddle.net>

On 15/04/17 11:54, Richard Henderson wrote:

> On 04/05/2017 01:35 AM, Mark Cave-Ayland wrote:
>> These aren't required since we can use the display width and height
>> directly.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>>  hw/display/cg3.c |   15 ++++++---------
>>  1 file changed, 6 insertions(+), 9 deletions(-)
>>
>> diff --git a/hw/display/cg3.c b/hw/display/cg3.c
>> index b42f60e..178a6dd 100644
>> --- a/hw/display/cg3.c
>> +++ b/hw/display/cg3.c
>> @@ -93,14 +93,11 @@ static void cg3_update_display(void *opaque)
>>      uint32_t *data;
>>      uint32_t dval;
>>      int x, y, y_start;
>> -    unsigned int width, height;
>>      ram_addr_t page, page_min, page_max;
>>
>>      if (surface_bits_per_pixel(surface) != 32) {
>>          return;
>>      }
>> -    width = s->width;
>> -    height = s->height;
>>
>>      y_start = -1;
>>      page_min = -1;
>> @@ -110,11 +107,11 @@ static void cg3_update_display(void *opaque)
>>      data = (uint32_t *)surface_data(surface);
>>
>>      memory_region_sync_dirty_bitmap(&s->vram_mem);
>> -    for (y = 0; y < height; y++) {
>> +    for (y = 0; y < s->height; y++) {
> 
> I suspect the generated code is much worse, since the compiler can no
> longer tell that the loop bounds are constant.
> 
> You probably do want to keep width and height in local variables across
> this function.

Can you explain a bit more about this? My thoughts were that with
optimisation enabled the compiler would assume s->width is constant
throughout the loop by default (or at least in OpenBIOS I've had to
explicitly mark variables as volatile to ensure the compiler refetches
the original value instead of reusing a previous copy from the
stack/registers)?


ATB,

Mark.

  reply	other threads:[~2017-04-18 14:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05  8:35 [Qemu-devel] [PATCH 00/14] TCX/CG3 adapter cleanups Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 01/14] cg3: remove TARGET_PAGE_SIZE rounding on dirty page detection Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 02/14] cg3: fix up size parameter for memory_region_get_dirty() Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 03/14] cg3: remove unused width and height variables Mark Cave-Ayland
2017-04-07 19:25   ` Philippe Mathieu-Daudé
2017-04-15 10:54   ` Richard Henderson
2017-04-18 14:38     ` Mark Cave-Ayland [this message]
2017-04-18 14:55       ` Richard Henderson
2017-04-21  7:00         ` Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 04/14] cg3: switch to load_image_mr() and remove prom-addr hack Mark Cave-Ayland
2017-04-15 14:39   ` Philippe Mathieu-Daudé
2017-04-05  8:35 ` [Qemu-devel] [PATCH 05/14] tcx: alter tcx_set_dirty() to accept address and length parameters Mark Cave-Ayland
2017-04-15 14:27   ` Philippe Mathieu-Daudé
2017-04-18 14:46     ` Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 06/14] tcx: ensure tcx_set_dirty() also invalidates the 24-bit plane and cplane Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 07/14] tcx: alter tcx24_check_dirty() to accept address and length parameters Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 08/14] tcx: alter tcx24_reset_dirty() " Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 09/14] tcx: remove page24 and cpage from tcx24_update_display() Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 10/14] tcx: remove TARGET_PAGE_SIZE from tcx_update_display() Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 11/14] tcx: remove TARGET_PAGE_SIZE from tcx24_update_display() Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 12/14] tcx: remove primitives for non-32-bit surfaces Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 13/14] tcx: use tcx_set_dirty() for accelerated ops Mark Cave-Ayland
2017-04-05  8:35 ` [Qemu-devel] [PATCH 14/14] tcx: switch to load_image_mr() and remove prom_addr hack Mark Cave-Ayland
2017-04-15 14:38   ` Philippe Mathieu-Daudé
2017-04-07 10:28 ` [Qemu-devel] [PATCH 00/14] TCX/CG3 adapter cleanups Gerd Hoffmann
2017-04-07 10:37   ` Mark Cave-Ayland
2017-04-07 11:00     ` Gerd Hoffmann

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=03d1cb2e-7b0d-7ae1-a884-413cf388762e@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.