Skip to content

Commit 024330f

Browse files
committed
Show unoptimized results
1 parent dae6cc1 commit 024330f

File tree

2 files changed

+174
-34
lines changed

2 files changed

+174
-34
lines changed

asm_tests/truc_asm_1/should_convert_vec_with_noop.asm.snap

Lines changed: 166 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,175 @@
44
.type should_convert_vec_with_noop,@function
55
should_convert_vec_with_noop:
66
.cfi_startproc
7-
mov rax, qword ptr [rsi]
8-
mov rcx, qword ptr [rsi + 8]
9-
mov rdx, qword ptr [rsi + 16]
10-
cmp rdx, 2
11-
jb .LBB6_3
12-
lea rsi, [rdx - 2]
13-
cmp rdx, rsi
14-
mov r8, rsi
15-
cmovb r8, rdx
16-
cmp rsi, r8
17-
jne .LBB6_2
18-
.LBB6_3:
7+
.cfi_personality 155, DW.ref.rust_eh_personality
8+
.cfi_lsda 27, .Lexception1
9+
push rbp
10+
.cfi_def_cfa_offset 16
11+
push r15
12+
.cfi_def_cfa_offset 24
13+
push r14
14+
.cfi_def_cfa_offset 32
15+
push r13
16+
.cfi_def_cfa_offset 40
17+
push r12
18+
.cfi_def_cfa_offset 48
19+
push rbx
20+
.cfi_def_cfa_offset 56
21+
sub rsp, 136
22+
.cfi_def_cfa_offset 192
23+
.cfi_offset rbx, -56
24+
.cfi_offset r12, -48
25+
.cfi_offset r13, -40
26+
.cfi_offset r14, -32
27+
.cfi_offset r15, -24
28+
.cfi_offset rbp, -16
29+
mov rcx, qword ptr [rsi]
30+
mov r14, qword ptr [rsi + 8]
31+
mov rbx, qword ptr [rsi + 16]
32+
test rbx, rbx
33+
je .LBB9_12
34+
mov qword ptr [rsp + 8], 1
35+
cmp rbx, 1
36+
je .LBB9_12
37+
lea r8, [rbx - 2]
38+
cmp rbx, r8
39+
mov rax, r8
40+
cmovb rax, rbx
41+
lea rsi, [rax + 1]
42+
mov edx, 1
43+
cmp rsi, 23
44+
jb .LBB9_9
45+
lea r10, [rsp + 24]
46+
lea r11, [r14 + 8]
47+
cmp rbx, r8
48+
cmovb r8, rbx
49+
lea r15, [r14 + 8*r8]
50+
add r15, 16
51+
lea r9, [rsp + 16]
52+
lea r8, [rsp + 16]
53+
cmp r8, r15
54+
setb bpl
55+
cmp r11, r10
56+
setb r13b
57+
cmp r8, r9
58+
setb r8b
59+
lea r12, [rsp + 8]
60+
cmp r12, r10
61+
setb r10b
62+
cmp r11, r9
63+
setb r9b
64+
cmp r12, r15
65+
setb r11b
66+
test bpl, r13b
67+
jne .LBB9_9
68+
and r8b, r10b
69+
jne .LBB9_9
70+
and r9b, r11b
71+
jne .LBB9_9
72+
mov edx, esi
73+
and edx, 3
74+
mov r8d, 4
75+
cmovne r8, rdx
76+
sub rsi, r8
77+
mov rdx, rsi
78+
inc rdx
1979
mov rsi, rax
20-
neg rsi
21-
jo .LBB6_5
22-
mov qword ptr [rdi], rax
23-
mov qword ptr [rdi + 8], rcx
24-
mov qword ptr [rdi + 16], rdx
25-
mov rax, rdi
26-
ret
80+
not rsi
81+
add rsi, r8
82+
mov r8d, 1
2783
.p2align 4
28-
.LBB6_2:
29-
jmp .LBB6_2
30-
.LBB6_5:
31-
push rax
84+
.LBB9_7:
85+
lea r9, [rsi + r8]
86+
add r9, 4
87+
add r8, 4
88+
cmp r9, 1
89+
jne .LBB9_7
90+
mov qword ptr [rsp + 16], r8
91+
mov qword ptr [rsp + 8], r8
92+
.LBB9_9:
93+
lea rsi, [rbx + 1]
94+
.p2align 4
95+
.LBB9_10:
96+
mov r9, qword ptr [r14 + 8*rdx]
97+
lea r8, [rdx + 1]
98+
mov qword ptr [rsp + 16], r8
99+
cmp rsi, rdx
100+
je .LBB9_14
101+
mov qword ptr [r14 + 8*rdx], r9
102+
mov qword ptr [rsp + 8], r8
103+
mov rdx, r8
104+
cmp rbx, r8
105+
jne .LBB9_10
106+
.LBB9_12:
107+
mov rax, rcx
108+
neg rax
109+
jo .LBB9_13
110+
mov qword ptr [rdi], rcx
111+
mov qword ptr [rdi + 8], r14
112+
mov qword ptr [rdi + 16], rbx
113+
mov rax, rdi
114+
add rsp, 136
115+
.cfi_def_cfa_offset 56
116+
pop rbx
117+
.cfi_def_cfa_offset 48
118+
pop r12
119+
.cfi_def_cfa_offset 40
120+
pop r13
121+
.cfi_def_cfa_offset 32
122+
pop r14
123+
.cfi_def_cfa_offset 24
124+
pop r15
32125
.cfi_def_cfa_offset 16
33-
lea rdi, [rip + .Lanon.76cbd883a681362e3f5caef3c5c31b76.5]
34-
lea rcx, [rip + .Lanon.76cbd883a681362e3f5caef3c5c31b76.4]
126+
pop rbp
127+
.cfi_def_cfa_offset 8
128+
ret
129+
.LBB9_13:
130+
.cfi_def_cfa_offset 192
131+
lea rdi, [rip + .Lanon.76cbd883a681362e3f5caef3c5c31b76.12]
132+
lea rcx, [rip + .Lanon.76cbd883a681362e3f5caef3c5c31b76.11]
35133
lea r8, [rip + .Lanon.76cbd883a681362e3f5caef3c5c31b76.1]
36-
lea rdx, [rsp + 7]
134+
lea rdx, [rsp + 88]
37135
mov esi, 43
38136
call qword ptr [rip + core::result::unwrap_failed@GOTPCREL]
137+
.LBB9_14:
138+
lea rdx, [rip + .Lanon.76cbd883a681362e3f5caef3c5c31b76.6]
139+
mov rdi, rax
140+
mov rsi, rbx
141+
call qword ptr [rip + core::panicking::panic_bounds_check@GOTPCREL]
142+
jmp .LBB9_15
143+
mov rdi, rax
144+
call qword ptr [rip + std::panicking::try::cleanup@GOTPCREL]
145+
mov qword ptr [rsp + 56], r14
146+
mov qword ptr [rsp + 64], rbx
147+
lea rcx, [rsp + 8]
148+
mov qword ptr [rsp + 72], rcx
149+
lea rcx, [rsp + 16]
150+
mov qword ptr [rsp + 80], rcx
151+
mov qword ptr [rsp + 24], rax
152+
mov qword ptr [rsp + 32], rdx
153+
lea rdi, [rsp + 56]
154+
call truc_runtime::convert::try_convert_vec_in_place::{{closure}}
155+
lea rax, [rsp + 24]
156+
mov qword ptr [rsp + 40], rax
157+
lea rax, [rip + <alloc::boxed::Box<T,A> as core::fmt::Debug>::fmt]
158+
mov qword ptr [rsp + 48], rax
159+
lea rax, [rip + .Lanon.76cbd883a681362e3f5caef3c5c31b76.2]
160+
mov qword ptr [rsp + 88], rax
161+
mov qword ptr [rsp + 96], 1
162+
mov qword ptr [rsp + 120], 0
163+
lea rax, [rsp + 40]
164+
mov qword ptr [rsp + 104], rax
165+
mov qword ptr [rsp + 112], 1
166+
lea rsi, [rip + .Lanon.76cbd883a681362e3f5caef3c5c31b76.3]
167+
lea rdi, [rsp + 88]
168+
call qword ptr [rip + core::panicking::panic_fmt@GOTPCREL]
169+
.LBB9_15:
170+
ud2
171+
mov rbx, rax
172+
mov rdi, qword ptr [rsp + 24]
173+
mov rsi, qword ptr [rsp + 32]
174+
call core::ptr::drop_in_place<alloc::boxed::Box<dyn core::any::Any+core::marker::Send>>
175+
mov rdi, rbx
176+
call _Unwind_Resume@PLT
177+
call qword ptr [rip + core::panicking::panic_in_cleanup@GOTPCREL]
178+
call qword ptr [rip + core::panicking::panic_cannot_unwind@GOTPCREL]

truc_runtime/src/convert.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ where
126126
Ok(())
127127
}));
128128

129-
fn clean_on_error<T, U>(slice: &mut [T], first_moved: usize, first_ttt: usize) {
129+
let clean_on_error = || {
130130
// Bring Us back into auto-drop land
131131
for element in &slice[0..first_moved] {
132132
let mut uuu = MaybeUninit::<U>::uninit();
@@ -143,7 +143,7 @@ where
143143
ttt.assume_init();
144144
}
145145
}
146-
}
146+
};
147147

148148
match maybe_panic {
149149
Ok(Ok(())) => {
@@ -155,11 +155,11 @@ where
155155
})
156156
}
157157
Ok(Err(err)) => {
158-
clean_on_error::<T, U>(slice, first_moved, first_ttt);
158+
clean_on_error();
159159
Err(err)
160160
}
161161
Err(err) => {
162-
clean_on_error::<T, U>(slice, first_moved, first_ttt);
162+
clean_on_error();
163163
panic!("{:?}", err);
164164
}
165165
}
@@ -237,7 +237,7 @@ where
237237
Ok(())
238238
}));
239239

240-
fn clean_on_error<T, U>(slice: &mut [T], first_moved: usize, first_ttt: usize) {
240+
let clean_on_error = || {
241241
// Bring Us back into auto-drop land
242242
for element in &slice[0..first_moved] {
243243
let mut uuu = MaybeUninit::<U>::uninit();
@@ -254,7 +254,7 @@ where
254254
ttt.assume_init();
255255
}
256256
}
257-
}
257+
};
258258

259259
match maybe_panic {
260260
Ok(Ok(())) => {
@@ -264,11 +264,11 @@ where
264264
})
265265
}
266266
Ok(Err(err)) => {
267-
clean_on_error::<T, U>(slice, first_moved, first_ttt);
267+
clean_on_error();
268268
Err(err)
269269
}
270270
Err(err) => {
271-
clean_on_error::<T, U>(slice, first_moved, first_ttt);
271+
clean_on_error();
272272
panic!("{:?}", err);
273273
}
274274
}

0 commit comments

Comments
 (0)