Skip to content

Commit 03a52b6

Browse files
committed
[codegen] Track thumbv7m-none-eabi, riscv32imc-unknown-none-elf
gherrit-pr-id: Gendq4lo5ioqhx5sfxgkq7iza57vwhm6e
1 parent e62a49e commit 03a52b6

166 files changed

Lines changed: 2479 additions & 359 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,11 @@ jobs:
624624
run: |
625625
set -eo pipefail
626626
sudo apt install -qq llvm
627+
# The codegen tests evaluate assembly for multiple target architectures.
628+
# These tests assume that `rustup` is installed on the host. We must
629+
# explicitly add the targets before compilation, because `rustc` aborts
630+
# when commanded to emit assembly for a target that has not been added.
631+
rustup target add --toolchain $(./cargo.sh --version nightly) thumbv7m-none-eabi riscv32imc-unknown-none-elf
627632
./cargo.sh +nightly install --quiet cargo-show-asm
628633
RUSTFLAGS="$RUSTFLAGS -Awarnings" ./cargo.sh +nightly test \
629634
--package zerocopy \

benches/formats/coco_dynamic_padding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use zerocopy_derive::*;
1+
use zerocopy::*;
22

33
// The only valid value of this type are the bytes `0xC0C0`.
44
#[derive(TryFromBytes, KnownLayout, Immutable)]

benches/formats/coco_dynamic_size.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use zerocopy_derive::*;
1+
use zerocopy::*;
22

33
// The only valid value of this type are the bytes `0xC0C0`.
44
#[derive(TryFromBytes, KnownLayout, Immutable)]

benches/formats/coco_static_size.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use zerocopy_derive::*;
1+
use zerocopy::*;
22

33
// The only valid value of this type are the bytes `0xC0C0`.
44
#[derive(TryFromBytes, KnownLayout, Immutable)]

benches/read_from_bytes.cortex-m3

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
bench_read_from_bytes_static_size:
2+
push {r7, lr}
3+
mov r7, sp
4+
cmp r2, #6
5+
bne .LBB0_2
6+
ldrh r2, [r1]
7+
ldr.w r1, [r1, #2]
8+
strh r2, [r0, #2]
9+
str r1, [r0, #4]
10+
movs r1, #1
11+
strh r1, [r0]
12+
pop {r7, pc}
13+
.LBB0_2:
14+
movs r1, #0
15+
strh r1, [r0]
16+
pop {r7, pc}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
bench_read_from_bytes_static_size:
2+
li a3, 6
3+
bne a2, a3, .LBB0_2
4+
lbu a6, 4(a1)
5+
lbu a3, 5(a1)
6+
lbu a4, 1(a1)
7+
lbu a5, 0(a1)
8+
lbu a2, 2(a1)
9+
lbu a1, 3(a1)
10+
slli a4, a4, 8
11+
or a4, a4, a5
12+
slli a6, a6, 16
13+
slli a3, a3, 24
14+
or a3, a3, a6
15+
slli a1, a1, 8
16+
or a1, a1, a2
17+
srli a3, a3, 16
18+
sh a4, 2(a0)
19+
sh a1, 4(a0)
20+
sh a3, 6(a0)
21+
li a1, 1
22+
sh a1, 0(a0)
23+
ret
24+
.LBB0_2:
25+
sh zero, 0(a0)
26+
ret

benches/read_from_bytes.x86-64

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
bench_read_from_bytes_static_size:
22
mov rcx, rsi
33
cmp rsi, 6
4-
jne .LBB5_2
4+
jne .LBB0_2
55
mov eax, dword ptr [rdi]
66
movzx ecx, word ptr [rdi + 4]
77
shl rcx, 32
88
or rcx, rax
9-
.LBB5_2:
9+
.LBB0_2:
1010
shl rcx, 16
1111
inc rcx
1212
xor eax, eax

benches/read_from_bytes.x86-64.mca

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Instruction Info:
2020
[1] [2] [3] [4] [5] [6] Instructions:
2121
1 1 0.33 mov rcx, rsi
2222
1 1 0.33 cmp rsi, 6
23-
1 1 1.00 jne .LBB5_2
23+
1 1 1.00 jne .LBB0_2
2424
1 5 0.50 * mov eax, dword ptr [rdi]
2525
1 5 0.50 * movzx ecx, word ptr [rdi + 4]
2626
1 1 0.50 shl rcx, 32
@@ -52,7 +52,7 @@ Resource pressure by instruction:
5252
[0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions:
5353
- - 0.63 0.36 - 0.01 - - mov rcx, rsi
5454
- - 0.05 0.05 - 0.90 - - cmp rsi, 6
55-
- - - - - 1.00 - - jne .LBB5_2
55+
- - - - - 1.00 - - jne .LBB0_2
5656
- - - - - - - 1.00 mov eax, dword ptr [rdi]
5757
- - - - - - 1.00 - movzx ecx, word ptr [rdi + 4]
5858
- - 0.97 - - 0.03 - - shl rcx, 32

benches/read_from_prefix.cortex-m3

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
bench_read_from_prefix_static_size:
2+
push {r7, lr}
3+
mov r7, sp
4+
cmp r2, #6
5+
bhs .LBB1_2
6+
movs r1, #0
7+
strh r1, [r0]
8+
pop {r7, pc}
9+
.LBB1_2:
10+
ldr r2, [r1]
11+
ldrh r1, [r1, #4]
12+
str.w r2, [r0, #2]
13+
strh r1, [r0, #6]
14+
movs r1, #1
15+
strh r1, [r0]
16+
pop {r7, pc}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
bench_read_from_prefix_static_size:
2+
li a3, 6
3+
bgeu a2, a3, .LBB1_2
4+
sh zero, 0(a0)
5+
ret
6+
.LBB1_2:
7+
lbu a6, 4(a1)
8+
lbu a3, 5(a1)
9+
lbu a4, 0(a1)
10+
lbu a5, 1(a1)
11+
lbu a2, 2(a1)
12+
lbu a1, 3(a1)
13+
slli a3, a3, 8
14+
or a3, a3, a6
15+
slli a2, a2, 16
16+
slli a1, a1, 24
17+
or a1, a1, a2
18+
slli a5, a5, 8
19+
or a4, a4, a5
20+
srli a1, a1, 16
21+
sh a4, 2(a0)
22+
sh a1, 4(a0)
23+
sh a3, 6(a0)
24+
li a1, 1
25+
sh a1, 0(a0)
26+
ret

0 commit comments

Comments
 (0)