public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/18906] New: Assembler complains about previously acceptable code
@ 2004-12-09 16:32 orion at cora dot nwra dot com
  2004-12-09 16:38 ` [Bug regression/18906] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: orion at cora dot nwra dot com @ 2004-12-09 16:32 UTC (permalink / raw)
  To: gcc-bugs

The following code:

static inline int cpuid_edx(int op)
{
     int eax, ecx, edx;

     __asm__("push %%ebx\n\tcpuid\n\tpop %%ebx"
             : "=a" (eax), "=c" (ecx), "=d" (edx)
             : "a" (op));
     return edx;
}

int RIGHT_CPU(void)
{
     return cpuid_edx(1);
}

Compiles fine on a Fedora Core 2 system with gcc version 3.3.3 20040412 (Red Hat
Linux 3.3.3-7), and on a i386 FC3 system with gcc 3.4.2.

On x86_64 Fedora Core 3 with gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3) or
version 4.0.0 20041019 (Red Hat 4.0.0-0.8) I get the following error:

/tmp/cckzukZW.s: Assembler messages:
/tmp/cckzukZW.s:27: Error: suffix or operands invalid for `push'
/tmp/cckzukZW.s:29: Error: suffix or operands invalid for `pop'

Assembler code is:

        .file   "sse2-cpuid.c"
        .text
.globl RIGHT_CPU
        .type   RIGHT_CPU, @function
RIGHT_CPU:
.LFB3:
        pushq   %rbp
.LCFI0:
        movq    %rsp, %rbp
.LCFI1:
        movl    $1, %edi
        call    cpuid_edx
        leave
        ret
.LFE3:
        .size   RIGHT_CPU, .-RIGHT_CPU
        .type   cpuid_edx, @function
cpuid_edx:
.LFB2:
        pushq   %rbp
.LCFI2:
        movq    %rsp, %rbp
.LCFI3:
        movl    %edi, -4(%rbp)
        movl    -4(%rbp), %eax
#APP
        push %ebx
        cpuid
        pop %ebx
#NO_APP
        movl    %eax, -8(%rbp)
        movl    %ecx, %eax
        movl    %eax, -12(%rbp)
        movl    %edx, %eax
        movl    %eax, -16(%rbp)
        movl    -16(%rbp), %eax
        leave
        ret
.LFE2:
        .size   cpuid_edx, .-cpuid_edx
        .section        .eh_frame,"a",@progbits
.Lframe1:
        .long   .LECIE1-.LSCIE1
.LSCIE1:
        .long   0x0
        .byte   0x1
        .string ""
        .uleb128 0x1
        .sleb128 -8
        .byte   0x10
        .byte   0xc
        .uleb128 0x7
        .uleb128 0x8
        .byte   0x90
        .uleb128 0x1
        .align 8
.LECIE1:
.LSFDE1:
        .long   .LEFDE1-.LASFDE1
.LASFDE1:
        .long   .LASFDE1-.Lframe1
        .quad   .LFB3
        .quad   .LFE3-.LFB3
        .byte   0x4
        .long   .LCFI0-.LFB3
        .byte   0xe
        .uleb128 0x10
        .byte   0x86
        .uleb128 0x2
        .byte   0x4
        .long   .LCFI1-.LCFI0
        .byte   0xd
        .uleb128 0x6
        .align 8
.LEFDE1:
.LSFDE3:
        .long   .LEFDE3-.LASFDE3
.LASFDE3:
        .long   .LASFDE3-.Lframe1
        .quad   .LFB2
        .quad   .LFE2-.LFB2
        .byte   0x4
        .long   .LCFI2-.LFB2
        .byte   0xe
       .uleb128 0x10
        .byte   0x86
        .uleb128 0x2
        .byte   0x4
        .long   .LCFI3-.LCFI2
        .byte   0xd
        .uleb128 0x6
        .align 8
.LEFDE3:
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)"

-- 
           Summary: Assembler complains about previously acceptable code
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: orion at cora dot nwra dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-redhat-linux-gnu
  GCC host triplet: x86_64-redhat-linux-gnu
GCC target triplet: x86_64-redhat-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18906


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug regression/18906] Assembler complains about previously acceptable code
  2004-12-09 16:32 [Bug regression/18906] New: Assembler complains about previously acceptable code orion at cora dot nwra dot com
@ 2004-12-09 16:38 ` pinskia at gcc dot gnu dot org
  2004-12-09 16:49 ` orion at cora dot nwra dot com
  2004-12-09 16:51 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-09 16:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-09 16:38 -------
Not a bug, you want pushl and popl instead.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18906


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug regression/18906] Assembler complains about previously acceptable code
  2004-12-09 16:32 [Bug regression/18906] New: Assembler complains about previously acceptable code orion at cora dot nwra dot com
  2004-12-09 16:38 ` [Bug regression/18906] " pinskia at gcc dot gnu dot org
@ 2004-12-09 16:49 ` orion at cora dot nwra dot com
  2004-12-09 16:51 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: orion at cora dot nwra dot com @ 2004-12-09 16:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From orion at cora dot nwra dot com  2004-12-09 16:49 -------
Changed to:

static inline int cpuid_edx(int op)
{
     int eax, ecx, edx;

     __asm__("pushl %%ebx\n\tcpuid\n\tpopl %%ebx"
             : "=a" (eax), "=c" (ecx), "=d" (edx)
             : "a" (op));
     return edx;
}

int RIGHT_CPU(void)
{
     return cpuid_edx(1);
}

Still get the same error:

# gcc4 -c sse2-cpuid.c
/tmp/ccAQFD0o.s: Assembler messages:
/tmp/ccAQFD0o.s:27: Error: suffix or operands invalid for `push'
/tmp/ccAQFD0o.s:29: Error: suffix or operands invalid for `pop'


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18906


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug regression/18906] Assembler complains about previously acceptable code
  2004-12-09 16:32 [Bug regression/18906] New: Assembler complains about previously acceptable code orion at cora dot nwra dot com
  2004-12-09 16:38 ` [Bug regression/18906] " pinskia at gcc dot gnu dot org
  2004-12-09 16:49 ` orion at cora dot nwra dot com
@ 2004-12-09 16:51 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-09 16:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-09 16:51 -------
Still not a gcc bug, I cannot be as it is complaining about the inline asm and not what gcc produces.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18906


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-12-09 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-09 16:32 [Bug regression/18906] New: Assembler complains about previously acceptable code orion at cora dot nwra dot com
2004-12-09 16:38 ` [Bug regression/18906] " pinskia at gcc dot gnu dot org
2004-12-09 16:49 ` orion at cora dot nwra dot com
2004-12-09 16:51 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).