-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from slothy-optimizer/tutorial
Thanks @mkannwischer !
- Loading branch information
Showing
26 changed files
with
7,866 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ldr q0, [x1, #0] | ||
ldr q1, [x2, #0] | ||
|
||
ldr q8, [x0] | ||
ldr q9, [x0, #1*16] | ||
ldr q10, [x0, #2*16] | ||
ldr q11, [x0, #3*16] | ||
|
||
mul v24.8h, v9.8h, v0.h[0] | ||
sqrdmulh v9.8h, v9.8h, v0.h[1] | ||
mls v24.8h, v9.8h, v1.h[0] | ||
sub v9.8h, v8.8h, v24.8h | ||
add v8.8h, v8.8h, v24.8h | ||
|
||
mul v24.8h, v11.8h, v0.h[0] | ||
sqrdmulh v11.8h, v11.8h, v0.h[1] | ||
mls v24.8h, v11.8h, v1.h[0] | ||
sub v11.8h, v10.8h, v24.8h | ||
add v10.8h, v10.8h, v24.8h | ||
|
||
str q8, [x0], #4*16 | ||
str q9, [x0, #-3*16] | ||
str q10, [x0, #-2*16] | ||
str q11, [x0, #-1*16] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
qdata0 .req q8 | ||
qdata1 .req q9 | ||
qdata2 .req q10 | ||
qdata3 .req q11 | ||
|
||
qtwiddle .req q0 | ||
qmodulus .req q1 | ||
|
||
data0 .req v8 | ||
data1 .req v9 | ||
data2 .req v10 | ||
data3 .req v11 | ||
|
||
twiddle .req v0 | ||
modulus .req v1 | ||
|
||
tmp .req v12 | ||
|
||
data_ptr .req x0 | ||
twiddle_ptr .req x1 | ||
modulus_ptr .req x2 | ||
|
||
.macro barmul out, in, twiddle, modulus | ||
mul \out.8h, \in.8h, \twiddle.h[0] | ||
sqrdmulh \in.8h, \in.8h, \twiddle.h[1] | ||
mls \out.8h, \in.8h, \modulus.h[0] | ||
.endm | ||
|
||
.macro butterfly data0, data1, tmp, twiddle, modulus | ||
barmul \tmp, \data1, \twiddle, \modulus | ||
sub \data1.8h, \data0.8h, \tmp.8h | ||
add \data0.8h, \data0.8h, \tmp.8h | ||
.endm | ||
|
||
count .req x2 | ||
ldr qtwiddle, [twiddle_ptr, #0] | ||
ldr qmodulus, [modulus_ptr, #0] | ||
mov count, #16 | ||
start: | ||
|
||
ldr qdata0, [data_ptr, #0*16] | ||
ldr qdata1, [data_ptr, #1*16] | ||
ldr qdata2, [data_ptr, #2*16] | ||
ldr qdata3, [data_ptr, #3*16] | ||
|
||
butterfly data0, data1, tmp, twiddle, modulus | ||
butterfly data2, data3, tmp, twiddle, modulus | ||
|
||
str qdata0, [data_ptr], #4*16 | ||
str qdata1, [data_ptr, #-3*16] | ||
str qdata2, [data_ptr, #-2*16] | ||
str qdata3, [data_ptr, #-1*16] | ||
|
||
subs count, count, #1 | ||
cbnz count, start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
qdata0 .req q8 | ||
qdata1 .req q9 | ||
qdata2 .req q10 | ||
qdata3 .req q11 | ||
|
||
qtwiddle .req q0 | ||
qmodulus .req q1 | ||
|
||
data0 .req v8 | ||
data1 .req v9 | ||
data2 .req v10 | ||
data3 .req v11 | ||
|
||
twiddle .req v0 | ||
modulus .req v1 | ||
|
||
tmp .req v12 | ||
|
||
data_ptr .req x0 | ||
twiddle_ptr .req x1 | ||
modulus_ptr .req x2 | ||
|
||
.macro barmul out, in, twiddle, modulus | ||
mul \out.8h, \in.8h, \twiddle.h[0] | ||
sqrdmulh \in.8h, \in.8h, \twiddle.h[1] | ||
mls \out.8h, \in.8h, \modulus.h[0] | ||
.endm | ||
|
||
.macro butterfly data0, data1, tmp, twiddle, modulus | ||
barmul \tmp, \data1, \twiddle, \modulus | ||
sub \data1.8h, \data0.8h, \tmp.8h | ||
add \data0.8h, \data0.8h, \tmp.8h | ||
.endm | ||
|
||
count .req x2 | ||
|
||
start: | ||
|
||
ldr qtwiddle, [twiddle_ptr, #0] | ||
ldr qmodulus, [modulus_ptr, #0] | ||
|
||
ldr qdata0, [data_ptr, #0*16] | ||
ldr qdata1, [data_ptr, #1*16] | ||
ldr qdata2, [data_ptr, #2*16] | ||
ldr qdata3, [data_ptr, #3*16] | ||
|
||
butterfly data0, data1, tmp, twiddle, modulus | ||
butterfly data2, data3, tmp, twiddle, modulus | ||
|
||
str qdata0, [data_ptr], #4*16 | ||
str qdata1, [data_ptr, #-3*16] | ||
str qdata2, [data_ptr, #-2*16] | ||
str qdata3, [data_ptr, #-1*16] | ||
|
||
end: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
qdata0 .req q8 | ||
qdata1 .req q9 | ||
qdata2 .req q10 | ||
qdata3 .req q11 | ||
|
||
qtwiddle .req q0 | ||
qmodulus .req q1 | ||
|
||
data0 .req v8 | ||
data1 .req v9 | ||
data2 .req v10 | ||
data3 .req v11 | ||
|
||
twiddle .req v0 | ||
modulus .req v1 | ||
|
||
tmp .req v12 | ||
|
||
data_ptr .req x0 | ||
twiddle_ptr .req x1 | ||
modulus_ptr .req x2 | ||
|
||
.macro barmul out, in, twiddle, modulus | ||
mul \out.8h, \in.8h, \twiddle.h[0] | ||
sqrdmulh \in.8h, \in.8h, \twiddle.h[1] | ||
mls \out.8h, \in.8h, \modulus.h[0] | ||
.endm | ||
|
||
.macro butterfly data0, data1, tmp, twiddle, modulus | ||
barmul \tmp, \data1, \twiddle, \modulus | ||
sub \data1.8h, \data0.8h, \tmp.8h | ||
add \data0.8h, \data0.8h, \tmp.8h | ||
.endm | ||
|
||
count .req x2 | ||
ldr qtwiddle, [twiddle_ptr, #0] | ||
ldr qmodulus, [modulus_ptr, #0] | ||
mov count, #16 | ||
ldr q3, [x0, #16] | ||
sqrdmulh v7.8H, v3.8H, v0.H[1] | ||
sub count, count, #1 | ||
start: | ||
mul v3.8H, v3.8H, v0.H[0] // ....*............. | ||
// gap // .................. | ||
ldr q19, [x0, #48] // ...*.............. | ||
// gap // .................. | ||
// gap // .................. | ||
// gap // .................. | ||
ldr q15, [x0, #0] // *................. | ||
// gap // .................. | ||
// gap // .................. | ||
// gap // .................. | ||
mls v3.8H, v7.8H, v1.H[0] // ......*........... | ||
// gap // .................. | ||
mul v13.8H, v19.8H, v0.H[0] // .........*........ | ||
// gap // .................. | ||
sqrdmulh v19.8H, v19.8H, v0.H[1] // ..........*....... | ||
// gap // .................. | ||
ldr q7, [x0, #32] // ..*............... | ||
// gap // .................. | ||
// gap // .................. | ||
// gap // .................. | ||
sub v17.8H, v15.8H, v3.8H // .......*.......... | ||
// gap // .................. | ||
add v10.8H, v15.8H, v3.8H // ........*......... | ||
// gap // .................. | ||
mls v13.8H, v19.8H, v1.H[0] // ...........*...... | ||
// gap // .................. | ||
str q17, [x0, #16] // ...............*.. | ||
// gap // .................. | ||
ldr q3, [x0, #80] // .e................ | ||
// gap // .................. | ||
// gap // .................. | ||
// gap // .................. | ||
add v15.8H, v7.8H, v13.8H // .............*.... | ||
// gap // .................. | ||
str q10, [x0], #4*16 // ..............*... | ||
// gap // .................. | ||
sub v13.8H, v7.8H, v13.8H // ............*..... | ||
// gap // .................. | ||
str q15, [x0, #-32] // ................*. | ||
// gap // .................. | ||
sqrdmulh v7.8H, v3.8H, v0.H[1] // .....e............ | ||
// gap // .................. | ||
str q13, [x0, #-16] // .................* | ||
// gap // .................. | ||
|
||
// original source code | ||
// ldr q8, [x0, #0*16] // .......|.*............... | ||
// ldr q9, [x0, #1*16] // e......|..........e...... | ||
// ldr q10, [x0, #2*16] // .......|.....*........... | ||
// ldr q11, [x0, #3*16] // .......|*................ | ||
// mul v12.8h, v9.8h, v0.h[0] // .......*................. | ||
// sqrdmulh v9.8h, v9.8h, v0.h[1] // .....e.|...............e. | ||
// mls v12.8h, v9.8h, v1.h[0] // .......|..*.............. | ||
// sub v9.8h, v8.8h, v12.8h // .......|......*.......... | ||
// add v8.8h, v8.8h, v12.8h // .......|.......*......... | ||
// mul v12.8h, v11.8h, v0.h[0] // .......|...*............. | ||
// sqrdmulh v11.8h, v11.8h, v0.h[1] // .......|....*............ | ||
// mls v12.8h, v11.8h, v1.h[0] // .......|........*........ | ||
// sub v11.8h, v10.8h, v12.8h // ...*...|.............*... | ||
// add v10.8h, v10.8h, v12.8h // .*.....|...........*..... | ||
// str q8, [x0], #4*16 // ..*....|............*.... | ||
// str q9, [x0, #-3*16] // .......|.........*....... | ||
// str q10, [x0, #-2*16] // ....*..|..............*.. | ||
// str q11, [x0, #-1*16] // ......*|................* | ||
|
||
sub count, count, #1 | ||
cbnz count, start | ||
mul v3.8H, v3.8H, v0.H[0] | ||
ldr q19, [x0, #48] | ||
ldr q15, [x0, #0] | ||
mls v3.8H, v7.8H, v1.H[0] | ||
mul v13.8H, v19.8H, v0.H[0] | ||
sqrdmulh v19.8H, v19.8H, v0.H[1] | ||
ldr q7, [x0, #32] | ||
sub v17.8H, v15.8H, v3.8H | ||
add v10.8H, v15.8H, v3.8H | ||
mls v13.8H, v19.8H, v1.H[0] | ||
str q17, [x0, #16] | ||
add v15.8H, v7.8H, v13.8H | ||
str q10, [x0], #4*16 | ||
sub v13.8H, v7.8H, v13.8H | ||
str q15, [x0, #-32] | ||
str q13, [x0, #-16] |
Oops, something went wrong.