Message ID | 20210420013308.813323-3-matheus.ferst@eldorado.org.br (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | tests/docker: tests/tcg/ppc64le: Newer toolchain to build tests for PowerISA v3.1 instructions | expand |
On 4/19/21 6:33 PM, matheus.ferst@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~
On 4/19/21 6:33 PM, matheus.ferst@eldorado.org.br wrote: > +#include <stdio.h> > +#include <assert.h> > + > +int main(void) > +{ Oh, also, there's nothing in here that requires stdio.h. r~
On 20/04/2021 11:58, Richard Henderson wrote: > On 4/19/21 6:33 PM, matheus.ferst@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 <http://www.eldorado.org.br/> Analista de Software Júnior Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>
On 20/04/2021 11:58, Richard Henderson wrote: > On 4/19/21 6:33 PM, matheus.ferst@eldorado.org.br wrote: >> +#include <stdio.h> >> +#include <assert.h> >> + >> +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 <http://www.eldorado.org.br/> Analista de Software Júnior Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>
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 0000000000..553b9870ae --- /dev/null +++ b/tests/tcg/ppc64le/byte_reverse.c @@ -0,0 +1,22 @@ +#include <stdio.h> +#include <assert.h> + +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; +} +