Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
tests: tcg: ppc64: Add tests for Vector Extract Mask Instructions
Add test for vextractbm, vextractwm, vextractdm and vextractqm instructions. Test works for both qemu-ppc64 and qemu-ppc64le. Based on the test case written by John Platts posted at [1] References: [1] - https://gitlab.com/qemu-project/qemu/-/issues/1536 Signed-off-by: John Platts <john_platts@hotmail.com> Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Reviewed-by: Lucas Mateus Castro <lucas.araujo@eldorado.org.br> Reviewed-by: Cédric Le Goater <clg@redhat.com> Message-Id: <168319294881.1159309.17060400720026083557.stgit@ltc-boston1.aus.stglabs.ibm.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
- Loading branch information
1 parent
6a5d81b
commit 0eb9fcc
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #include <assert.h> | ||
| #include <stdint.h> | ||
| #include "qemu/compiler.h" | ||
|
|
||
| int main(void) | ||
| { | ||
| unsigned int result_wi; | ||
| vector unsigned char vbc_bi_src = { 0xFF, 0xFF, 0, 0xFF, 0xFF, 0xFF, | ||
| 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, | ||
| 0, 0xFF, 0xFF}; | ||
| vector unsigned short vbc_hi_src = { 0xFFFF, 0, 0, 0xFFFF, | ||
| 0, 0, 0xFFFF, 0xFFFF}; | ||
| vector unsigned int vbc_wi_src = {0, 0, 0xFFFFFFFF, 0xFFFFFFFF}; | ||
| vector unsigned long long vbc_di_src = {0xFFFFFFFFFFFFFFFF, 0}; | ||
| vector __uint128_t vbc_qi_src; | ||
|
|
||
| asm("vextractbm %0, %1" : "=r" (result_wi) : "v" (vbc_bi_src)); | ||
| #if HOST_BIG_ENDIAN | ||
| assert(result_wi == 0b1101111111000011); | ||
| #else | ||
| assert(result_wi == 0b1100001111111011); | ||
| #endif | ||
|
|
||
| asm("vextracthm %0, %1" : "=r" (result_wi) : "v" (vbc_hi_src)); | ||
| #if HOST_BIG_ENDIAN | ||
| assert(result_wi == 0b10010011); | ||
| #else | ||
| assert(result_wi == 0b11001001); | ||
| #endif | ||
|
|
||
| asm("vextractwm %0, %1" : "=r" (result_wi) : "v" (vbc_wi_src)); | ||
| #if HOST_BIG_ENDIAN | ||
| assert(result_wi == 0b0011); | ||
| #else | ||
| assert(result_wi == 0b1100); | ||
| #endif | ||
|
|
||
| asm("vextractdm %0, %1" : "=r" (result_wi) : "v" (vbc_di_src)); | ||
| #if HOST_BIG_ENDIAN | ||
| assert(result_wi == 0b10); | ||
| #else | ||
| assert(result_wi == 0b01); | ||
| #endif | ||
|
|
||
| vbc_qi_src[0] = 0x1; | ||
| vbc_qi_src[0] = vbc_qi_src[0] << 127; | ||
| asm("vextractqm %0, %1" : "=r" (result_wi) : "v" (vbc_qi_src)); | ||
| assert(result_wi == 0b1); | ||
|
|
||
| return 0; | ||
| } |