mirror of
https://github.com/qemu/qemu.git
synced 2024-12-03 08:43:38 +08:00
e2c3fb0699
tests/tcg/s390x/mie3-compl.c: [N]*K instructions tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction tests/tcg/s390x/mie3-sel.c: SELECT instruction Signed-off-by: David Miller <dmiller423@gmail.com> Message-Id: <20220223223117.66660-4-dmiller423@gmail.com> [thuth: Squash mnemonic -> .insn patch, white space cleanup, improve asm usage] Signed-off-by: Thomas Huth <thuth@redhat.com>
49 lines
1.6 KiB
C
49 lines
1.6 KiB
C
#include <stdint.h>
|
|
|
|
#define FbinOp(S, ASM) uint64_t S(uint64_t a, uint64_t b) \
|
|
{ \
|
|
uint64_t res = 0; \
|
|
asm ("llihf %[res],801\n" ASM \
|
|
: [res]"=&r"(res) : [a]"r"(a), [b]"r"(b) : "cc"); \
|
|
return res; \
|
|
}
|
|
|
|
/* AND WITH COMPLEMENT */
|
|
FbinOp(_ncrk, ".insn rrf, 0xB9F50000, %[res], %[b], %[a], 0\n")
|
|
FbinOp(_ncgrk, ".insn rrf, 0xB9E50000, %[res], %[b], %[a], 0\n")
|
|
|
|
/* NAND */
|
|
FbinOp(_nnrk, ".insn rrf, 0xB9740000, %[res], %[b], %[a], 0\n")
|
|
FbinOp(_nngrk, ".insn rrf, 0xB9640000, %[res], %[b], %[a], 0\n")
|
|
|
|
/* NOT XOR */
|
|
FbinOp(_nxrk, ".insn rrf, 0xB9770000, %[res], %[b], %[a], 0\n")
|
|
FbinOp(_nxgrk, ".insn rrf, 0xB9670000, %[res], %[b], %[a], 0\n")
|
|
|
|
/* NOR */
|
|
FbinOp(_nork, ".insn rrf, 0xB9760000, %[res], %[b], %[a], 0\n")
|
|
FbinOp(_nogrk, ".insn rrf, 0xB9660000, %[res], %[b], %[a], 0\n")
|
|
|
|
/* OR WITH COMPLEMENT */
|
|
FbinOp(_ocrk, ".insn rrf, 0xB9750000, %[res], %[b], %[a], 0\n")
|
|
FbinOp(_ocgrk, ".insn rrf, 0xB9650000, %[res], %[b], %[a], 0\n")
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
if (_ncrk(0xFF88, 0xAA11) != 0x0000032100000011ull ||
|
|
_nnrk(0xFF88, 0xAA11) != 0x00000321FFFF55FFull ||
|
|
_nork(0xFF88, 0xAA11) != 0x00000321FFFF0066ull ||
|
|
_nxrk(0xFF88, 0xAA11) != 0x00000321FFFFAA66ull ||
|
|
_ocrk(0xFF88, 0xAA11) != 0x00000321FFFFAA77ull ||
|
|
_ncgrk(0xFF88, 0xAA11) != 0x0000000000000011ull ||
|
|
_nngrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFF55FFull ||
|
|
_nogrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFF0066ull ||
|
|
_nxgrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFFAA66ull ||
|
|
_ocgrk(0xFF88, 0xAA11) != 0xFFFFFFFFFFFFAA77ull)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|