binutils-gdb/sim/testsuite/bpf/mem.s
Mike Frysinger 1368b914e9 sim: testsuite: flatten tree
Now that all port tests live under testsuite/sim/*/, and none live
in testsuite/ directly, flatten the structure by moving all of the
dirs under testsuite/sim/ to testsuite/ directly.

We need to stop passing --tool to dejagnu so that it searches all
dirs and not just ones that start with "sim".  Since we have no
other dirs in this tree, and no plans to add any, should be fine.
2021-01-15 19:18:34 -05:00

57 lines
1.4 KiB
ArmAsm

# mach: bpf
# output: pass\nexit 0 (0x0)\n
;;; mem.s
;;; Tests for BPF memory (ldx, stx, ..) instructions in simulator
.include "testutils.inc"
.text
.global main
.type main, @function
main:
lddw %r1, 0x1234deadbeef5678
mov %r2, 0x1000
;; basic store/load check
stxb [%r2+0], %r1
stxh [%r2+2], %r1
stxw [%r2+4], %r1
stxdw [%r2+8], %r1
stb [%r2+16], 0x5a
sth [%r2+18], 0xcafe
stw [%r2+20], 0xbeefface
stdw [%r2+24], 0x7eadbeef
ldxb %r1, [%r2+16]
fail_ne %r1, 0x5a
ldxh %r1, [%r2+18]
fail_ne %r1, 0xffffffffffffcafe
ldxw %r1, [%r2+20]
fail_ne %r1, 0xffffffffbeefface
ldxdw %r1, [%r2+24]
fail_ne %r1, 0x7eadbeef
ldxb %r3, [%r2+0]
fail_ne %r3, 0x78
ldxh %r3, [%r2+2]
fail_ne %r3, 0x5678
ldxw %r3, [%r2+4]
fail_ne %r3, 0xffffffffbeef5678
ldxdw %r3, [%r2+8]
fail_ne %r3, 0x1234deadbeef5678
ldxw %r4, [%r2+10]
fail_ne %r4, 0xffffffffdeadbeef
;; negative offsets
add %r2, 16
ldxh %r5, [%r2+-14]
fail_ne %r5, 0x5678
ldxw %r5, [%r2+-12]
fail_ne %r5, 0xffffffffbeef5678
ldxdw %r5, [%r2+-8]
fail_ne %r5, 0x1234deadbeef5678
pass