From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752527AbbCZAF4 (ORCPT ); Wed, 25 Mar 2015 20:05:56 -0400 Received: from mail-ie0-f177.google.com ([209.85.223.177]:36389 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752498AbbCZAFv (ORCPT ); Wed, 25 Mar 2015 20:05:51 -0400 MIME-Version: 1.0 In-Reply-To: References: <1427303896-24023-1-git-send-email-dvlasenk@redhat.com> <1427303896-24023-3-git-send-email-dvlasenk@redhat.com> Date: Wed, 25 Mar 2015 17:05:50 -0700 X-Google-Sender-Auth: uAxpqLTwFe8W0DmPOf0tu8czBHM Message-ID: Subject: Re: [PATCH 3/4] x86/asm/entry/64: use smaller insns From: Linus Torvalds To: "H. Peter Anvin" Cc: Denys Vlasenko , Ingo Molnar , Steven Rostedt , Borislav Petkov , Andy Lutomirski , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , "the arch/x86 maintainers" , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 25, 2015 at 4:56 PM, H. Peter Anvin wrote: > No, movabs is yet another instruction (with a 64-bit absolute address.) But movq can mean 10 or 7 bytes... I mentioned movabs because that is literally what as generates at least for me (or then objdump is confused): [torvalds@i7 ~]$ as -v GNU assembler version 2.24 (x86_64-redhat-linux) using BFD version version 2.24 [torvalds@i7 ~]$ cat t.s main: movq $0x12, %rdi movq $0x1234, %rdi movq $0x123456, %rdi movq $0x12345678, %rdi movq $0x123456789ab, %rdi [torvalds@i7 ~]$ as t.s [torvalds@i7 ~]$ objdump -d a.out ... 0: 48 c7 c7 12 00 00 00 mov $0x12,%rdi 7: 48 c7 c7 34 12 00 00 mov $0x1234,%rdi e: 48 c7 c7 56 34 12 00 mov $0x123456,%rdi 15: 48 c7 c7 78 56 34 12 mov $0x12345678,%rdi 1c: 48 bf ab 89 67 45 23 movabs $0x123456789ab,%rdi 23: 01 00 00 so 'as' is clearly just stupid. It already takes the size of the constant into account and generates different instructions. Why not for the common 32-bit case too? Oh well. Linus