x86-64: Allow loads from some structs/unions
GCC allows register loads for asms based on type mode, and correctly sized structs/union have an allowed mode (basically 1,2,4,8 sized aggregates).
This commit is contained in:
@ -2677,6 +2677,7 @@ void asm_test(void)
|
||||
struct struct1231 s2 = { (unsigned long)&s1 };
|
||||
/* Hide the outer base_func, but check later that the inline
|
||||
asm block gets the outer one. */
|
||||
int base_func = 42;
|
||||
void override_func3 (void);
|
||||
unsigned long asmret;
|
||||
|
||||
@ -2720,6 +2721,11 @@ void asm_test(void)
|
||||
override_func2();
|
||||
/* The base_func ref from the following inline asm should find
|
||||
the global one, not the local decl from this function. */
|
||||
asm volatile(".weak override_func3\n.set override_func3, base_func");
|
||||
override_func3();
|
||||
/* Check that we can also load structs of appropriate layout
|
||||
into registers. */
|
||||
asm volatile("" : "=r" (asmret) : "0"(s2));
|
||||
if (asmret != s2.addr)
|
||||
printf("asmstr: failed\n");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user