From: "H. Peter Anvin" <hpa@zytor.com>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
Andi Kleen <ak@muc.de>, Chuck Ebbert <cebbert@redhat.com>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [patch 4/7] Immediate Values - i386 Optimization
Date: Sat, 20 Oct 2007 11:32:10 -0700 [thread overview]
Message-ID: <471A49AA.6090407@zytor.com> (raw)
In-Reply-To: <20071020164721.GA6614@Krystal>
Mathieu Desnoyers wrote:
>
> I have tried generating asm-to-"register" c variables for char, short
> and int on i386 and I do not see this happening. The char opcode is
> always 1 byte, short 2 bytes and int 1 byte. Result:
>
The comment was referring to x86-64, but I incorrectly remembered that
applying to "movq $imm,%reg" as opposed to loading from an absolute
address. gas actually has a special opcode (movabs) for the 64-bit
version of the latter variant, which is only available with %rax and its
subregisters.
Nevermind, in other words. It's still true, though, that the immediate
will always be the last thing in the instruction -- that's a fixture of
the instruction format.
> gcc version 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
>
> 8: b3 02 mov $0x2,%bl
> a: b1 03 mov $0x3,%cl
> c: b2 04 mov $0x4,%dl
> e: b0 05 mov $0x5,%al
>
> 4f: 66 be 06 00 mov $0x6,%si
> 53: 66 bb 07 00 mov $0x7,%bx
> 57: 66 b9 08 00 mov $0x8,%cx
> 5b: 66 ba 09 00 mov $0x9,%dx
> 5f: 66 b8 0a 00 mov $0xa,%ax
>
> 9f: bb 0b 00 00 00 mov $0xb,%ebx
> a4: be 0c 00 00 00 mov $0xc,%esi
> a9: b9 0d 00 00 00 mov $0xd,%ecx
> ae: ba 0e 00 00 00 mov $0xe,%edx
> b3: b8 0f 00 00 00 mov $0xf,%eax
>
>
> I notice that having a "=r" inline assembly that outputs to the first
> "register char" variable seems to be problematic. It fails with the
> following error:
>
> /tmp/ccy35Hq1.s: Assembler messages:
> /tmp/ccy35Hq1.s:15: Error: bad register name `%sil'
'r' is wrong for 8-bit variables on i386. It needs to be 'q'.
next prev parent reply other threads:[~2007-10-20 18:36 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 21:07 [patch 0/7] Immediate Values for 2.6.23-rc6-mm1 Mathieu Desnoyers
2007-09-18 21:07 ` [patch 1/7] Immediate Values - Architecture Independent Code Mathieu Desnoyers
2007-09-18 21:07 ` [patch 2/7] Immediate Values - Kconfig menu in EMBEDDED Mathieu Desnoyers
2007-09-18 22:02 ` Randy Dunlap
2007-09-19 11:13 ` Mathieu Desnoyers
2007-09-18 21:07 ` [patch 3/7] Immediate Values - Move Kprobes i386 restore_interrupt to kdebug.h Mathieu Desnoyers
2007-09-18 21:07 ` [patch 4/7] Immediate Values - i386 Optimization Mathieu Desnoyers
2007-09-18 21:51 ` Jeremy Fitzhardinge
2007-09-18 22:12 ` H. Peter Anvin
2007-09-18 22:27 ` Jeremy Fitzhardinge
2007-09-19 13:01 ` Mathieu Desnoyers
2007-09-19 16:03 ` Mathieu Desnoyers
2007-09-19 16:12 ` H. Peter Anvin
2007-09-19 17:30 ` Jeremy Fitzhardinge
2007-09-19 17:39 ` H. Peter Anvin
2007-09-19 18:31 ` Mathieu Desnoyers
2007-09-19 18:22 ` Mathieu Desnoyers
2007-10-20 16:47 ` Mathieu Desnoyers
2007-10-20 18:32 ` H. Peter Anvin [this message]
2007-10-22 15:40 ` Mathieu Desnoyers
2007-10-22 16:39 ` H. Peter Anvin
2007-10-22 9:53 ` Andi Kleen
2007-09-19 11:00 ` Mathieu Desnoyers
2007-09-18 22:14 ` Andi Kleen
2007-09-18 22:29 ` Jeremy Fitzhardinge
2007-09-18 22:33 ` H. Peter Anvin
2007-09-18 22:44 ` Andi Kleen
2007-09-19 11:08 ` Mathieu Desnoyers
2007-09-19 11:14 ` Andi Kleen
2007-09-19 10:59 ` Mathieu Desnoyers
2007-09-20 10:24 ` Denys Vlasenko
2007-09-21 13:31 ` Mathieu Desnoyers
2007-09-18 21:07 ` [patch 5/7] Immediate Values - Powerpc Optimization Mathieu Desnoyers
2007-09-18 21:07 ` [patch 6/7] Immediate Values - Documentation Mathieu Desnoyers
2007-09-18 21:07 ` [patch 7/7] Scheduler Profiling - Use Immediate Values Mathieu Desnoyers
-- strict thread matches above, loose matches on Subject: below --
2007-09-17 18:42 [patch 0/7] " Mathieu Desnoyers
2007-09-17 18:42 ` [patch 4/7] Immediate Values - i386 Optimization Mathieu Desnoyers
2007-09-18 6:04 ` Borislav Petkov
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=471A49AA.6090407@zytor.com \
--to=hpa@zytor.com \
--cc=ak@muc.de \
--cc=akpm@linux-foundation.org \
--cc=cebbert@redhat.com \
--cc=hch@infradead.org \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
/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