Re: [PATCH 2/2] tests/tcg/ppc64le: tests for brh/brw/brd

2021-04-20 Thread Matheus K. Ferst

On 20/04/2021 11:58, Richard Henderson wrote:

On 4/19/21 6:33 PM, matheus.fe...@eldorado.org.br wrote:

+    var = 0xFEDCBA9876543210;
+    asm("brh %0, %0" : "=r"(var));
+    assert(var == 0xDCFE98BA54761032);


Incorrect inline assembly, you are not declaring an input.
Use "+r" for in/out argument.


r~


Fixed, thanks!

Matheus K. Ferst
Instituto de Pesquisas ELDORADO 
Analista de Software Júnior
Aviso Legal - Disclaimer 



Re: [PATCH 2/2] tests/tcg/ppc64le: tests for brh/brw/brd

2021-04-20 Thread Richard Henderson

On 4/19/21 6:33 PM, matheus.fe...@eldorado.org.br wrote:

+#include 
+#include 
+
+int main(void)
+{


Oh, also, there's nothing in here that requires stdio.h.


r~



Re: [PATCH 2/2] tests/tcg/ppc64le: tests for brh/brw/brd

2021-04-20 Thread Matheus K. Ferst

On 20/04/2021 11:58, Richard Henderson wrote:

On 4/19/21 6:33 PM, matheus.fe...@eldorado.org.br wrote:

+#include 
+#include 
+
+int main(void)
+{


Oh, also, there's nothing in here that requires stdio.h.


r~


Forgot to remove. Will be fixed in the next version.

Thanks,
Matheus K. Ferst
Instituto de Pesquisas ELDORADO 
Analista de Software Júnior
Aviso Legal - Disclaimer 



Re: [PATCH 2/2] tests/tcg/ppc64le: tests for brh/brw/brd

2021-04-20 Thread Richard Henderson

On 4/19/21 6:33 PM, matheus.fe...@eldorado.org.br wrote:

+var = 0xFEDCBA9876543210;
+asm("brh %0, %0" : "=r"(var));
+assert(var == 0xDCFE98BA54761032);


Incorrect inline assembly, you are not declaring an input.
Use "+r" for in/out argument.


r~



[PATCH 2/2] tests/tcg/ppc64le: tests for brh/brw/brd

2021-04-19 Thread matheus . ferst
From: Matheus Ferst 

Tests for Byte-Reverse Halfword, Word and Doubleword

Signed-off-by: Matheus Ferst 
---
 tests/tcg/ppc64/Makefile.target   |  7 +++
 tests/tcg/ppc64le/Makefile.target |  7 +++
 tests/tcg/ppc64le/byte_reverse.c  | 22 ++
 3 files changed, 36 insertions(+)
 create mode 100644 tests/tcg/ppc64le/byte_reverse.c

diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target
index 0c6a4585fc..55c690c8ad 100644
--- a/tests/tcg/ppc64/Makefile.target
+++ b/tests/tcg/ppc64/Makefile.target
@@ -10,4 +10,11 @@ PPC64_TESTS=bcdsub
 endif
 bcdsub: CFLAGS += -mpower8-vector
 
+ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
+POWER10_TESTS=byte_reverse
+RUN_POWER10_TESTS=$(patsubst %, run-%, $(POWER10_TESTS))
+$(RUN_POWER10_TESTS): QEMU_OPTS+=-cpu POWER10
+PPC64_TESTS += $(POWER10_TESTS)
+endif
+
 TESTS += $(PPC64_TESTS)
diff --git a/tests/tcg/ppc64le/Makefile.target 
b/tests/tcg/ppc64le/Makefile.target
index 1acfcff94a..517d290b1a 100644
--- a/tests/tcg/ppc64le/Makefile.target
+++ b/tests/tcg/ppc64le/Makefile.target
@@ -9,4 +9,11 @@ PPC64LE_TESTS=bcdsub
 endif
 bcdsub: CFLAGS += -mpower8-vector
 
+ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
+POWER10_TESTS=byte_reverse
+RUN_POWER10_TESTS=$(patsubst %, run-%, $(POWER10_TESTS))
+$(RUN_POWER10_TESTS): QEMU_OPTS+=-cpu POWER10
+PPC64LE_TESTS += $(POWER10_TESTS)
+endif
+
 TESTS += $(PPC64LE_TESTS)
diff --git a/tests/tcg/ppc64le/byte_reverse.c b/tests/tcg/ppc64le/byte_reverse.c
new file mode 100644
index 00..553b9870ae
--- /dev/null
+++ b/tests/tcg/ppc64le/byte_reverse.c
@@ -0,0 +1,22 @@
+#include 
+#include 
+
+int main(void)
+{
+unsigned long var;
+
+var = 0xFEDCBA9876543210;
+asm("brh %0, %0" : "=r"(var));
+assert(var == 0xDCFE98BA54761032);
+
+var = 0xFEDCBA9876543210;
+asm("brw %0, %0" : "=r"(var));
+assert(var == 0x98BADCFE10325476);
+
+var = 0xFEDCBA9876543210;
+asm("brd %0, %0" : "=r"(var));
+assert(var == 0x1032547698BADCFE);
+
+return 0;
+}
+
-- 
2.25.1