Compiling the following code results in invalid asm:
#include <stdint.h>
typedef union {
int64_t q;
} __attribute__ ((aligned (8))) mmx_t;
int main(int argc, char **argv)
{
mmx_t a;
mmx_t *b=&a;
__asm__ __volatile__("movq %0, %%mm0" : : "X" (*b)); /* produces
invalid asm code */
}
The equivalent
#include <stdint.h>
typedef union {
int64_t q;
} __attribute__ ((aligned (8))) mmx_t;
int main(int argc, char **argv)
{
mmx_t a;
__asm__ __volatile__("movq %0, %%mm0" : : "X" (a)); /* works */
}
works.
The invalid asm code being generated is "movq %eax,%mm0".
--
Summary: asm("movq %0, %mm0" : : "X"(*a)) generates invalid asm
code
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: inline-asm
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bero at arklinux dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-ark-linux
GCC host triplet: i686-ark-linux
GCC target triplet: i686-ark-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20202