From 0b0e64c2c95487815a8d252ab833e5eccfb5aeb5 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 3 Oct 2016 20:39:48 +0200 Subject: x86-asm: Correct register size for pointer ops A pointer is 64 bit as well, so it needs a full register for register operands. --- tests/tcctest.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/tcctest.c b/tests/tcctest.c index 496de3a..22d9e88 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -2914,6 +2914,11 @@ void fancy_copy (unsigned *in, unsigned *out) asm volatile ("" : "=r" (*out) : "0" (*in)); } +void fancy_copy2 (unsigned *in, unsigned *out) +{ + asm volatile ("mov %0,(%1)" : : "r" (*in), "r" (out) : "memory"); +} + void asm_test(void) { char buf[128]; @@ -2987,6 +2992,9 @@ void asm_test(void) val = 43; fancy_copy (&val, &val2); printf ("fancycpy(%d)=%d\n", val, val2); + val = 44; + fancy_copy2 (&val, &val2); + printf ("fancycpy2(%d)=%d\n", val, val2); return; label1: goto label2; -- cgit v1.3.1