mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Denis Vlasenko <vda@ilport.com.ua>
To: <cutaway@bellsouth.net>, "Jesper Juhl" <juhl-lkml@dif.dk>,
	"linux-kernel" <linux-kernel@vger.kernel.org>
Cc: "Andrew Morton" <akpm@osdl.org>,
	"Jeff Garzik" <jgarzik@pobox.com>,
	"Domen Puncer" <domen@coderock.org>
Subject: Re: [RFC] cleanup patches for strings
Date: Tue, 21 Jun 2005 16:20:31 +0300	[thread overview]
Message-ID: <200506211620.31655.vda@ilport.com.ua> (raw)
In-Reply-To: <004c01c57662$5eacc260$2800000a@pc365dualp2>

Um, prev one was using push %reg. My fault.
push $imm gives the same result:

# gcc -O2 -falign-loops=64 t.c
# ./a.out
Took 9291 CPU cycles Took 8068 CPU cycles
Took 9080 CPU cycles Took 8058 CPU cycles
Took 9134 CPU cycles Took 8061 CPU cycles
Took 9084 CPU cycles Took 8043 CPU cycles
Took 9084 CPU cycles Took 8043 CPU cycles
Took 9084 CPU cycles Took 8043 CPU cycles

The source:

#define rdtscl(low) asm volatile("rdtsc" : "=a" (low) : : "edx")

#define NL "\n"

#include <stdio.h>

int main() {
    int i,k,start,end;
    int v = 1234;

for(k=0; k<6; k++) {
    rdtscl(start);
    for(i=0; i<1000; i++) {
        asm(NL
        "       push    %0" NL
        "       pop     %%eax" NL
        "       push    %0" NL
        "       pop     %%eax" NL
        "       push    %0" NL
        "       pop     %%eax" NL
        "       push    %0" NL
        "       pop     %%eax" NL
        : /* outputs */
        : "m" (v) /* inputs */
        : "ax" /* clobbers */
        );
    }
    rdtscl(end);
    printf("Took %u CPU cycles ", end-start);

    rdtscl(start);
    for(i=0; i<1000; i++) {
        asm(NL
        "       push    $1234" NL
        "       pop     %%eax" NL
        "       push    $1234" NL
        "       pop     %%eax" NL
        "       push    $1234" NL
        "       pop     %%eax" NL
        "       push    $1234" NL
        "       pop     %%eax" NL
        : /* outputs */
        : /* inputs */
        : "ax" /* clobbers */
        );
    }
    rdtscl(end);
    printf("Took %u CPU cycles\n", end-start);
}
    return 0;
}
--
vda


  parent reply	other threads:[~2005-06-21 13:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-20 22:46 Jesper Juhl
2005-06-21  6:58 ` cutaway
2005-06-21 11:02   ` Denis Vlasenko
2005-06-21 13:08     ` cutaway
2005-06-21 13:06       ` Denis Vlasenko
2005-06-21 14:38         ` cutaway
2005-06-21 13:52           ` Denis Vlasenko
2005-06-21 13:20       ` Denis Vlasenko [this message]
2005-06-21  8:59 ` Alexey Dobriyan
2005-06-21  9:31   ` Jörn Engel
2005-06-21 20:47     ` Jesper Juhl
2005-06-21  9:04 ` Andrey Panin
2005-06-21 10:59 ` Denis Vlasenko
2005-06-21 21:24   ` Jean Delvare
2005-06-21 22:33     ` cutaway
2005-06-21 21:49       ` Jean Delvare
2005-06-21 23:11         ` cutaway
2005-06-22  0:16           ` Brian Gerst
2005-06-21 21:12 ` Horst von Brand

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=200506211620.31655.vda@ilport.com.ua \
    --to=vda@ilport.com.ua \
    --cc=akpm@osdl.org \
    --cc=cutaway@bellsouth.net \
    --cc=domen@coderock.org \
    --cc=jgarzik@pobox.com \
    --cc=juhl-lkml@dif.dk \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®