Skip to content

Commit 0b55492

Browse files
authored
Merge pull request #126 from dthaler/shift
Add tests for shifting by out of range immediate
2 parents b798975 + be7ad4f commit 0b55492

13 files changed

+109
-5
lines changed

src/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,22 @@ enable_testing()
7777

7878
add_test(
7979
NAME cpu_v1
80-
COMMAND sudo ${PROJECT_BINARY_DIR}/bin/bpf_conformance_runner --test_file_directory ${PROJECT_BINARY_DIR}/tests --plugin_path ${PROJECT_BINARY_DIR}/bin/libbpf_plugin --xdp_prolog true --cpu_version v1
80+
COMMAND sudo ${PROJECT_BINARY_DIR}/bin/bpf_conformance_runner --test_file_directory ${PROJECT_BINARY_DIR}/tests --plugin_path ${PROJECT_BINARY_DIR}/bin/libbpf_plugin --xdp_prolog true --cpu_version v1 --exclude_regex "imm-"
8181
)
8282

8383
add_test(
8484
NAME cpu_v2
85-
COMMAND sudo ${PROJECT_BINARY_DIR}/bin/bpf_conformance_runner --test_file_directory ${PROJECT_BINARY_DIR}/tests --plugin_path ${PROJECT_BINARY_DIR}/bin/libbpf_plugin --xdp_prolog true --cpu_version v2
85+
COMMAND sudo ${PROJECT_BINARY_DIR}/bin/bpf_conformance_runner --test_file_directory ${PROJECT_BINARY_DIR}/tests --plugin_path ${PROJECT_BINARY_DIR}/bin/libbpf_plugin --xdp_prolog true --cpu_version v2 --exclude_regex "imm-"
8686
)
8787

8888
add_test(
8989
NAME cpu_v3
90-
COMMAND sudo ${PROJECT_BINARY_DIR}/bin/bpf_conformance_runner --test_file_directory ${PROJECT_BINARY_DIR}/tests --plugin_path ${PROJECT_BINARY_DIR}/bin/libbpf_plugin --xdp_prolog true --cpu_version v3 --debug true --list_instructions true
90+
COMMAND sudo ${PROJECT_BINARY_DIR}/bin/bpf_conformance_runner --test_file_directory ${PROJECT_BINARY_DIR}/tests --plugin_path ${PROJECT_BINARY_DIR}/bin/libbpf_plugin --xdp_prolog true --cpu_version v3 --debug true --list_instructions true --exclude_regex "imm-"
9191
)
9292

9393
add_test(
9494
NAME elf_format
95-
COMMAND sudo ${PROJECT_BINARY_DIR}/bin/bpf_conformance_runner --test_file_directory ${PROJECT_BINARY_DIR}/tests --plugin_path ${PROJECT_BINARY_DIR}/bin/libbpf_plugin --xdp_prolog true --debug true --list_instructions true --elf true --exclude_regex "call_local*"
95+
COMMAND sudo ${PROJECT_BINARY_DIR}/bin/bpf_conformance_runner --test_file_directory ${PROJECT_BINARY_DIR}/tests --plugin_path ${PROJECT_BINARY_DIR}/bin/libbpf_plugin --xdp_prolog true --debug true --list_instructions true --elf true --exclude_regex "(call_local*|imm-)"
9696
)
9797

9898
add_test(
@@ -433,4 +433,4 @@ set_tests_properties(
433433
add_test(
434434
NAME back_compat
435435
COMMAND sudo ${PROJECT_BINARY_DIR}/bin/bpf_conformance_runner --test_file_path ${PROJECT_BINARY_DIR}/tests/add.data --plugin_path ${PROJECT_BINARY_DIR}/bin/libbpf_plugin
436-
)
436+
)

tests/arsh32-imm-high.data

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) Big Switch Networks, Inc
2+
# SPDX-License-Identifier: Apache-2.0
3+
-- asm
4+
mov32 %r0, 0xf8
5+
lsh32 %r0, 28
6+
# %r0 == 0x80000000
7+
arsh32 %r0, 48
8+
exit
9+
-- result
10+
0xffff8000

tests/arsh32-imm-neg.data

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) Big Switch Networks, Inc
2+
# SPDX-License-Identifier: Apache-2.0
3+
-- asm
4+
mov32 %r0, 0xf8
5+
lsh32 %r0, 28
6+
# %r0 == 0x80000000
7+
arsh32 %r0, -16
8+
exit
9+
-- result
10+
0xffff8000

tests/arsh64-imm-high.data

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) Big Switch Networks, Inc
2+
# SPDX-License-Identifier: Apache-2.0
3+
-- asm
4+
mov32 %r0, 1
5+
lsh %r0, 63
6+
arsh %r0, 124
7+
exit
8+
-- result
9+
0xfffffffffffffff8

tests/arsh64-imm-neg.data

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) Big Switch Networks, Inc
2+
# SPDX-License-Identifier: Apache-2.0
3+
-- asm
4+
mov32 %r0, 1
5+
lsh %r0, 63
6+
arsh %r0, -4
7+
exit
8+
-- result
9+
0xfffffffffffffff8

tests/lsh32-imm-high.data

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) Big Switch Networks, Inc
2+
# SPDX-License-Identifier: Apache-2.0
3+
-- asm
4+
mov %r0, 0x11
5+
lsh32 %r0, 60
6+
exit
7+
-- result
8+
0x10000000

tests/lsh32-imm-neg.data

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) Big Switch Networks, Inc
2+
# SPDX-License-Identifier: Apache-2.0
3+
-- asm
4+
mov %r0, 0x11
5+
lsh32 %r0, -4
6+
exit
7+
-- result
8+
0x10000000

tests/lsh64-imm-high.data

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) Big Switch Networks, Inc
2+
# SPDX-License-Identifier: Apache-2.0
3+
-- asm
4+
mov %r0, 0x1
5+
lsh %r0, 68
6+
exit
7+
-- result
8+
0x10

tests/lsh64-imm-neg.data

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) Big Switch Networks, Inc
2+
# SPDX-License-Identifier: Apache-2.0
3+
-- asm
4+
mov %r0, 0x1
5+
lsh %r0, -60
6+
exit
7+
-- result
8+
0x10

tests/rsh32-imm-high.data

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) Big Switch Networks, Inc
2+
# SPDX-License-Identifier: Apache-2.0
3+
-- asm
4+
mov %r0, 0
5+
sub %r0, 1
6+
rsh32 %r0, 40
7+
exit
8+
-- result
9+
0x00ffffff

0 commit comments

Comments
 (0)