mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 18:44:58 -06:00
tests/tcg/s390x: Add C(G)HRL test
Test COMPARE HALFWORD RELATIVE LONG instructions. Test that the bytes following the second operand do not affect the instruction. Test the sign extension performed on the second operand. Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: David Hildenbrand <david@redhat.com> Message-Id: <20230310114157.3024170-3-nsg@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
54fce97cfc
commit
410791228c
2 changed files with 81 additions and 0 deletions
|
@ -28,6 +28,7 @@ TESTS+=div
|
|||
TESTS+=clst
|
||||
TESTS+=long-double
|
||||
TESTS+=cdsg
|
||||
TESTS+=chrl
|
||||
|
||||
cdsg: CFLAGS+=-pthread
|
||||
cdsg: LDFLAGS+=-pthread
|
||||
|
|
80
tests/tcg/s390x/chrl.c
Normal file
80
tests/tcg/s390x/chrl.c
Normal file
|
@ -0,0 +1,80 @@
|
|||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static void test_chrl(void)
|
||||
{
|
||||
uint32_t program_mask, cc;
|
||||
|
||||
asm volatile (
|
||||
".pushsection .rodata\n"
|
||||
"0:\n\t"
|
||||
".short 1, 0x8000\n\t"
|
||||
".popsection\n\t"
|
||||
|
||||
"chrl %[r], 0b\n\t"
|
||||
"ipm %[program_mask]\n"
|
||||
: [program_mask] "=r" (program_mask)
|
||||
: [r] "r" (1)
|
||||
);
|
||||
|
||||
cc = program_mask >> 28;
|
||||
assert(!cc);
|
||||
|
||||
asm volatile (
|
||||
".pushsection .rodata\n"
|
||||
"0:\n\t"
|
||||
".short -1, 0x8000\n\t"
|
||||
".popsection\n\t"
|
||||
|
||||
"chrl %[r], 0b\n\t"
|
||||
"ipm %[program_mask]\n"
|
||||
: [program_mask] "=r" (program_mask)
|
||||
: [r] "r" (-1)
|
||||
);
|
||||
|
||||
cc = program_mask >> 28;
|
||||
assert(!cc);
|
||||
}
|
||||
|
||||
static void test_cghrl(void)
|
||||
{
|
||||
uint32_t program_mask, cc;
|
||||
|
||||
asm volatile (
|
||||
".pushsection .rodata\n"
|
||||
"0:\n\t"
|
||||
".short 1, 0x8000, 0, 0\n\t"
|
||||
".popsection\n\t"
|
||||
|
||||
"cghrl %[r], 0b\n\t"
|
||||
"ipm %[program_mask]\n"
|
||||
: [program_mask] "=r" (program_mask)
|
||||
: [r] "r" (1L)
|
||||
);
|
||||
|
||||
cc = program_mask >> 28;
|
||||
assert(!cc);
|
||||
|
||||
asm volatile (
|
||||
".pushsection .rodata\n"
|
||||
"0:\n\t"
|
||||
".short -1, 0x8000, 0, 0\n\t"
|
||||
".popsection\n\t"
|
||||
|
||||
"cghrl %[r], 0b\n\t"
|
||||
"ipm %[program_mask]\n"
|
||||
: [program_mask] "=r" (program_mask)
|
||||
: [r] "r" (-1L)
|
||||
);
|
||||
|
||||
cc = program_mask >> 28;
|
||||
assert(!cc);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
test_chrl();
|
||||
test_cghrl();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue