x86_64-asm: fix copy-out registers

If the destination is an indirect pointer access (which ends up
as VT_LLOCAL) the intermediate pointer must be loaded as VT_PTR,
not as whatever the pointed to type is.
This commit is contained in:
Michael Matz
2016-10-03 05:34:01 +02:00
parent ad723a419f
commit 0bca6cab06
2 changed files with 11 additions and 1 deletions

View File

@ -2909,10 +2909,15 @@ char * get_asm_string (void)
return str;
}
unsigned int set;
void fancy_copy (unsigned *in, unsigned *out)
{
asm volatile ("" : "=r" (*out) : "0" (*in));
}
void asm_test(void)
{
{
char buf[128];
unsigned int val, val2;
struct struct123 s1;
@ -2979,6 +2984,9 @@ void asm_test(void)
asm volatile("cmp %1,%2; sete %0" : "=a"(somebool) : "r"(1), "r"(2));
if (!somebool)
printf("asmbool: failed\n");
#endif
printf("asmstr: %s\n", get_asm_string());
val = 43;
fancy_copy (&val, &val2);
printf ("fancycpy(%d)=%d\n", val, val2);
return;