aboutsummaryrefslogtreecommitdiff
path: root/tests/tcctest.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-08-08 20:18:11 +0200
committerMichael Matz <matz@suse.de>2016-12-15 17:47:10 +0100
commitca8c1cd643b12cd652bb73804e1645b75292357a (patch)
treebced1ff0cf59d5eb5baa92000239959efd9bf53f /tests/tcctest.c
parent9ae10cad1fecc2be27691de0a37a1ed25abc9639 (diff)
downloadtinycc-ca8c1cd643b12cd652bb73804e1645b75292357a.tar.gz
tinycc-ca8c1cd643b12cd652bb73804e1645b75292357a.tar.bz2
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).
Diffstat (limited to 'tests/tcctest.c')
-rw-r--r--tests/tcctest.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c
index 30d78b8..f8a9ca6 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -2677,6 +2677,7 @@ void asm_test(void)
asm block gets the outer one. */
int base_func = 42;
void override_func3 (void);
+ unsigned long asmret;
printf("inline asm:\n");
@@ -2720,6 +2721,11 @@ void asm_test(void)
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;
label1:
goto label2;