Skip to content

Instantly share code, notes, and snippets.

@bartoszbielawski
Created February 18, 2019 13:37
Show Gist options
  • Save bartoszbielawski/633af21b841aaf7b3e8565fe47c5554c to your computer and use it in GitHub Desktop.
Save bartoszbielawski/633af21b841aaf7b3e8565fe47c5554c to your computer and use it in GitHub Desktop.
.file "test.cpp"
.text
.literal_position
.align 4
.global _Z11reverseBitsh
.type _Z11reverseBitsh, @function
_Z11reverseBitsh:
.LFB0:
extui a2, a2, 0, 8
slli a4, a2, 1
movi a3, -0x56
and a3, a4, a3
srai a2, a2, 1
movi.n a4, 0x55
and a2, a2, a4
or a2, a3, a2
extui a2, a2, 0, 8
slli a4, a2, 2
movi a3, -0x34
and a3, a4, a3
srai a2, a2, 2
movi.n a4, 0x33
and a2, a2, a4
or a3, a3, a2
extui a3, a3, 0, 8
slli a2, a3, 4
srli a3, a3, 4
or a2, a2, a3
extui a2, a2, 0, 8
ret.n
.LFE0:
.size _Z11reverseBitsh, .-_Z11reverseBitsh
.literal_position
.align 4
.global _Z18reverseBitsForLooph
.type _Z18reverseBitsForLooph, @function
_Z18reverseBitsForLooph:
.LFB1:
movi.n a3, 0
extui a4, a2, 0, 8
movi.n a5, 7
mov.n a2, a3
movi.n a6, 1
.L5:
bbc a4, a3, .L3
sub a7, a5, a3
ssl a7
sll a7, a6
or a2, a2, a7
extui a2, a2, 0, 8
.L3:
addi.n a3, a3, 1
bnei a3, 8, .L5
ret.n
.LFE1:
.size _Z18reverseBitsForLooph, .-_Z18reverseBitsForLooph
.ident "GCC: (crosstool-NG 1.20.0) 4.8.2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment