asm/qp: add stmqp tests
This commit is contained in:
parent
851ae69ee7
commit
f7be1449a5
@ -1,11 +1,12 @@
|
||||
#ifndef SRC_BASE_COMMON_H
|
||||
#define SRC_BASE_COMMON_H
|
||||
|
||||
#define NR_exit 1
|
||||
#define NR_write 4
|
||||
#define NR_rt_sigaction 174
|
||||
#define NR_rt_sigreturn 173
|
||||
#define NR_access_hw_stacks 254
|
||||
#define NR_exit 1
|
||||
#define NR_write 4
|
||||
#define NR_mmap 90
|
||||
#define NR_rt_sigaction 174
|
||||
#define NR_rt_sigreturn 173
|
||||
#define NR_access_hw_stacks 254
|
||||
|
||||
#define SCRATCH_REG0 %g23
|
||||
#define SCRATCH_REG1 %g22
|
||||
@ -85,6 +86,58 @@
|
||||
sys_exit 77
|
||||
.endm
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
#define MAP_SHARED 0x000001
|
||||
#define MAP_PRIVATE 0x000002
|
||||
#define MAP_SHARED_VALIDATE 0x000003
|
||||
#define MAP_ANONYMOUS 0x000010 /* don't use a file */
|
||||
#define MAP_FIXED 0x000100 /* Interpret addr exactly */
|
||||
#define MAP_DENYWRITE 0x000800 /* ETXTBSY */
|
||||
#define MAP_GROWSDOWN 0x001000 /* stack-like segment */
|
||||
#define MAP_GROWSUP 0x002000 /* register stack-like segment */
|
||||
#define MAP_EXECUTABLE 0x004000 /* mark it as an executable */
|
||||
#define MAP_LOCKED 0x008000 /* pages are locked */
|
||||
#define MAP_NORESERVE 0x010000 /* don't check for reservations */
|
||||
#define MAP_POPULATE 0x020000 /* populate (prefault) pagetables */
|
||||
#define MAP_NONBLOCK 0x040000 /* do not block on IO */
|
||||
#define MAP_FIRST32 0x080000 /* in protected mode map in */
|
||||
/* first 2 ** 32 area */
|
||||
#define MAP_WRITECOMBINED 0x100000 /* Write combine */
|
||||
#define MAP_HUGETLB 0x200000 /* create a huge page mapping */
|
||||
#define MAP_FIXED_NOREPLACE 0x400000 /* MAP_FIXED which doesn't unmap */
|
||||
/* underlying mapping */
|
||||
#define MAP_STACK MAP_GROWSDOWN
|
||||
|
||||
#define PROT_READ 0x1 /* page can be read */
|
||||
#define PROT_WRITE 0x2 /* page can be written */
|
||||
#define PROT_EXEC 0x4 /* page can be executed */
|
||||
#define PROT_SEM 0x8 /* page may be used for atomic ops */
|
||||
#define PROT_NONE 0x0 /* page can not be accessed */
|
||||
|
||||
.macro sys_mmap ret, addr, len, prot, flags, fd=-1, offset=0
|
||||
{
|
||||
setwd wsz=8, nfx=1
|
||||
setbn rsz=3, rbs=4, rcur=0
|
||||
sdisp %ctpr1, 0x3
|
||||
}
|
||||
addd,0 0, NR_mmap, %b[0]
|
||||
{
|
||||
addd,0 0, \addr, %b[1]
|
||||
addd,1 0, \len, %b[2]
|
||||
}
|
||||
{
|
||||
addd,0 0, \prot, %b[3]
|
||||
addd,1 0, \flags, %b[4]
|
||||
}
|
||||
{
|
||||
addd,0 0, \fd, %b[5]
|
||||
addd,1 0, \offset, %b[6]
|
||||
}
|
||||
call %ctpr1, wbs=4
|
||||
addd,0 0, %b[0], \ret
|
||||
.endm
|
||||
|
||||
#define write(MSG) \
|
||||
.pushsection ".rodata"; \
|
||||
local(str):; \
|
||||
|
@ -208,6 +208,17 @@ asm_tests = {
|
||||
'fxsubxx-1': {},
|
||||
'fxmulxx-1': {},
|
||||
},
|
||||
'qp': {
|
||||
'stmqp-1': {},
|
||||
'stmqp-unaligned-1': { 'should_fail': true, 'c_args': ['-DMAX_VER=6'] },
|
||||
'stmqp-unaligned-2': { 'should_fail': true, 'c_args': ['-DMAX_VER=6'] },
|
||||
'stmqp-unaligned-3': { 'src': 'stmqp-page-1', 'c_args': ['-DMIN_VER=6'] },
|
||||
'stmqp-unaligned-4': { 'src': 'stmqp-page-2', 'c_args': ['-DMIN_VER=6'] },
|
||||
'stmqp-page-1': { 'should_fail': true, 'c_args': ['-DMAX_VER=6'] },
|
||||
'stmqp-page-2': { 'should_fail': true, 'c_args': ['-DMAX_VER=6'] },
|
||||
'stmqp-page-3': { 'src': 'stmqp-page-1', 'c_args': ['-DMIN_VER=6'] },
|
||||
'stmqp-page-4': { 'src': 'stmqp-page-2', 'c_args': ['-DMIN_VER=6'] },
|
||||
},
|
||||
}
|
||||
|
||||
foreach suite, tests : asm_tests
|
||||
|
32
tests/asm/qp/stmqp-1.S
Normal file
32
tests/asm/qp/stmqp-1.S
Normal file
@ -0,0 +1,32 @@
|
||||
#include "test_start.S"
|
||||
|
||||
#if __iset__ >= 5
|
||||
{
|
||||
setwd wsz=8, nfx=0
|
||||
}
|
||||
{
|
||||
addd,0 0, 0xffeeddccbbaa9988, %g16
|
||||
addd,1 0, [ mem ], %g17
|
||||
}
|
||||
qppackdl,0 %g16, 0x7766554433221100, %g16
|
||||
stmqp,2 %g16, %g17, 0xaa55
|
||||
ldqp,0 %g17, 0, %g18
|
||||
qpswitchd,0 %g18, %g19
|
||||
assert_eq_i64(%g18, 0x0066004400220000)
|
||||
assert_eq_i64(%g19, 0xff00dd00bb009900)
|
||||
|
||||
stmqp,2 %g16, %g17, 0x55aa
|
||||
ldqp,0 %g17, 0, %g18
|
||||
qpswitchd,0 %g18, %g19
|
||||
assert_eq_i64(%g18, 0x7766554433221100)
|
||||
assert_eq_i64(%g19, 0xffeeddccbbaa9988)
|
||||
#else
|
||||
skip_test
|
||||
#endif
|
||||
|
||||
#include "test_end.S"
|
||||
|
||||
.data
|
||||
.balign 16
|
||||
mem:
|
||||
.fill 16, 1, 0
|
28
tests/asm/qp/stmqp-page-1.S
Normal file
28
tests/asm/qp/stmqp-page-1.S
Normal file
@ -0,0 +1,28 @@
|
||||
#include "test_start.S"
|
||||
|
||||
#ifndef MIN_VER
|
||||
# define MIN_VER 5
|
||||
#endif
|
||||
|
||||
#ifndef MAX_VER
|
||||
# define MAX_VER 99
|
||||
#endif
|
||||
|
||||
#if __iset__ >= MIN_VER && __iset__ < MAX_VER
|
||||
setwd wsz=8, nfx=0
|
||||
|
||||
sys_mmap %r0, 0, PAGE_SIZE * 3, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS
|
||||
addd,0 %r0, PAGE_SIZE, %r0
|
||||
sys_mmap %r0, %r0, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED
|
||||
|
||||
subd,0 0, 1, %r1
|
||||
stb,2 %r1, [ %r0 ]
|
||||
qppackdl,0 %r1, %r1, %r1
|
||||
|
||||
addd,0 %r0, PAGE_SIZE - 8, %g16
|
||||
stmqp,2 %r1, %g16, 0x00ff
|
||||
#else
|
||||
skip_test
|
||||
#endif
|
||||
|
||||
#include "test_end.S"
|
28
tests/asm/qp/stmqp-page-2.S
Normal file
28
tests/asm/qp/stmqp-page-2.S
Normal file
@ -0,0 +1,28 @@
|
||||
#include "test_start.S"
|
||||
|
||||
#ifndef MIN_VER
|
||||
#define MIN_VER 5
|
||||
#endif
|
||||
|
||||
#ifndef MAX_VER
|
||||
# define MAX_VER 99
|
||||
#endif
|
||||
|
||||
#if __iset__ >= MIN_VER && __iset__ < MAX_VER
|
||||
setwd wsz=8, nfx=0
|
||||
|
||||
sys_mmap %r0, 0, PAGE_SIZE * 3, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS
|
||||
addd,0 %r0, PAGE_SIZE, %r0
|
||||
sys_mmap %r0, %r0, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED
|
||||
|
||||
subd,0 0, 1, %r1
|
||||
stb,2 %r1, [ %r0 ]
|
||||
qppackdl,0 %r1, %r1, %r1
|
||||
|
||||
subd,0 %r0, 8, %g16
|
||||
stmqp,2 %r1, %g16, 0xff00
|
||||
#else
|
||||
skip_test
|
||||
#endif
|
||||
|
||||
#include "test_end.S"
|
28
tests/asm/qp/stmqp-unaligned-1.S
Normal file
28
tests/asm/qp/stmqp-unaligned-1.S
Normal file
@ -0,0 +1,28 @@
|
||||
#include "test_start.S"
|
||||
|
||||
#ifndef MIN_VER
|
||||
#define MIN_VER 5
|
||||
#endif
|
||||
|
||||
#ifndef MAX_VER
|
||||
# define MAX_VER 99
|
||||
#endif
|
||||
|
||||
#if __iset__ >= MIN_VER && __iset__ < MAX_VER
|
||||
{
|
||||
setwd wsz=8, nfx=0
|
||||
}
|
||||
qppackdl,0 0, 0, %g16
|
||||
addd,1 0, [ mem ], %g17
|
||||
stmqp,2 %g16, %g17, 0xaa55
|
||||
#else
|
||||
skip_test
|
||||
#endif
|
||||
|
||||
#include "test_end.S"
|
||||
|
||||
.data
|
||||
.balign 16
|
||||
.fill 8, 1, 0
|
||||
mem:
|
||||
.fill 16, 1, 0
|
28
tests/asm/qp/stmqp-unaligned-2.S
Normal file
28
tests/asm/qp/stmqp-unaligned-2.S
Normal file
@ -0,0 +1,28 @@
|
||||
#include "test_start.S"
|
||||
|
||||
#ifndef MIN_VER
|
||||
#define MIN_VER 5
|
||||
#endif
|
||||
|
||||
#ifndef MAX_VER
|
||||
# define MAX_VER 99
|
||||
#endif
|
||||
|
||||
#if __iset__ >= MIN_VER && __iset__ < MAX_VER
|
||||
{
|
||||
setwd wsz=8, nfx=0
|
||||
}
|
||||
qppackdl,0 0, 0, %g16
|
||||
addd,1 0, [ mem ], %g17
|
||||
stmqp,2 %g16, %g17, 0xaa55
|
||||
#else
|
||||
skip_test
|
||||
#endif
|
||||
|
||||
#include "test_end.S"
|
||||
|
||||
.data
|
||||
.balign 16
|
||||
.fill 1, 1, 0
|
||||
mem:
|
||||
.fill 16, 1, 0
|
Loading…
Reference in New Issue
Block a user