Skip to content

Commit 2d1cc90

Browse files
hanno-beckermkannwischer
authored andcommitted
AArch64 rej_uniform: Remove three dead instructions
Drop a dead `sub buflen, #24`, a dead `add output_tmp, ctr1, lsl #1` (immediately overwritten), and a `b` to the next label. The deletions shift later offsets, so the HOL-Light bytecode, PC/length constants, step ranges and state variables are adjusted to match; the proof still passes. Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
1 parent 0371acd commit 2d1cc90

4 files changed

Lines changed: 66 additions & 82 deletions

File tree

dev/aarch64_opt/src/rej_uniform_aarch64_asm.S

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ rej_uniform_loop48_end:
313313
cmp buflen, #24
314314
b.lo rej_uniform_memory_copy
315315

316-
sub buflen, buflen, #24
317316
ld3 {buf0.8b, buf1.8b, buf2.8b}, [buf], #24
318317

319318
zip1 tmp0.16b, buf0.16b, buf1.16b
@@ -356,7 +355,6 @@ rej_uniform_loop48_end:
356355
add output_tmp, output_tmp, ctr0, lsl #1
357356

358357
st1 {val1.8h}, [output_tmp]
359-
add output_tmp, output_tmp, ctr1, lsl #1
360358

361359
add count, count, ctr0
362360
add count, count, ctr1
@@ -385,7 +383,6 @@ rej_uniform_final_copy:
385383
b.lt rej_uniform_final_copy
386384

387385
mov x0, count
388-
b rej_uniform_return
389386

390387
rej_uniform_return:
391388
pop_stack

mlkem/src/native/aarch64/src/rej_uniform_aarch64_asm.S

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ Lrej_uniform_loop48_end:
159159
b.hs Lrej_uniform_memory_copy
160160
cmp x2, #0x18
161161
b.lo Lrej_uniform_memory_copy
162-
sub x2, x2, #0x18
163162
ld3 { v0.8b, v1.8b, v2.8b }, [x1], #24
164163
zip1 v4.16b, v0.16b, v1.16b
165164
zip1 v5.16b, v1.16b, v2.16b
@@ -188,7 +187,6 @@ Lrej_uniform_loop48_end:
188187
st1 { v16.8h }, [x7]
189188
add x7, x7, x12, lsl #1
190189
st1 { v17.8h }, [x7]
191-
add x7, x7, x13, lsl #1
192190
add x9, x9, x12
193191
add x9, x9, x13
194192

@@ -211,7 +209,6 @@ Lrej_uniform_final_copy:
211209
cmp x11, #0x100
212210
b.lt Lrej_uniform_final_copy
213211
mov x0, x9
214-
b Lrej_uniform_return
215212

216213
Lrej_uniform_return:
217214
add sp, sp, #0x240

proofs/hol_light/aarch64/mlkem/rej_uniform_aarch64_asm.S

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ Lrej_uniform_loop48_end:
161161
b.hs Lrej_uniform_memory_copy
162162
cmp x2, #0x18
163163
b.lo Lrej_uniform_memory_copy
164-
sub x2, x2, #0x18
165164
ld3 { v0.8b, v1.8b, v2.8b }, [x1], #24
166165
zip1 v4.16b, v0.16b, v1.16b
167166
zip1 v5.16b, v1.16b, v2.16b
@@ -190,7 +189,6 @@ Lrej_uniform_loop48_end:
190189
st1 { v16.8h }, [x7]
191190
add x7, x7, x12, lsl #1
192191
st1 { v17.8h }, [x7]
193-
add x7, x7, x13, lsl #1
194192
add x9, x9, x12
195193
add x9, x9, x13
196194

@@ -213,7 +211,6 @@ Lrej_uniform_final_copy:
213211
cmp x11, #0x100
214212
b.lt Lrej_uniform_final_copy
215213
mov x0, x9
216-
b Lrej_uniform_return
217214

218215
Lrej_uniform_return:
219216
add sp, sp, #0x240

0 commit comments

Comments
 (0)