sorear changed the topic of #riscv to: RISC-V instruction set architecture | https://riscv.org | Logs: https://libera.irclog.whitequark.org/riscv | Matrix: #riscv:catircservices.org
<sorear> sleb is also doing funny bitwise operations for sign extension in the one-byte case
<meowray> sorear: good point. do you have an unrolled sleb128 impl?
<sorear> lying around? no
luca_ has joined #riscv
luca_ is now known as OwlWizard
DesRoin has quit [Ping timeout: 272 seconds]
DesRoin has joined #riscv
Leopold has quit [Ping timeout: 260 seconds]
vagrantc has quit [Quit: leaving]
Leopold has joined #riscv
<sorear> that's a very 90s answer, thinking that a bitwise operation costs as much as a conditional branch...
<meowray> sorear: it seems zigzag is likely better https://godbolt.org/z/9zd8GWoEP
<sorear> for SLEB128 you can do temp += (byte < 64 ? byte : byte - 128) << shift;
<sorear> then change 64 to 128 for ULEB128
OwlWizard has quit [Quit: OwlWizard]
<meowray> sorear: ah yes. so, sleb128 (v < 64 ? v - 128 : v) wins?
JanC has quit [Ping timeout: 264 seconds]
<sorear> it's enough of a wash that I'm not comfortable declaring that without a benchmark
<meowray> v < 128 ? v < 64 ? v - 128 : v : slow(v); z < 128 ? (z >> 1) ^ -(z & 1) : slow(z); possibly better describes the one-byte fast path.
JanC has joined #riscv
JanC_ has joined #riscv
JanC is now known as Guest9757
Guest9757 has quit [Killed (molybdenum.libera.chat (Nickname regained by services))]
JanC_ is now known as JanC
<meowray> zigzag is noticeably worse on x86, slightly worse on aarch64
<sorear> musl dynlink code generally treats a missing DT_XXX the same as DT_XXX with val=0, which works for existing reloc types since SZ=0 -> that type of reloc isn't present
<sorear> there's a secondary mechanism based on a bitmask for DT_XXX less than 32 :)
<sorear> there doesn't seem to be anything preventing CREL from having a file virtual address of 0
<sorear> https://gist.github.com/sorear/f17038387b871ff0a16c74a85d987c05 early proof of concept. the relocation count is also used for pre-allocating the per-dso lazy reloc buffer
heat has joined #riscv
Trifton has quit [Quit: Client exited]
Leopold has quit [Ping timeout: 260 seconds]
Leopold has joined #riscv
aredridel4 has quit [Quit: The Lounge - https://thelounge.chat]
aredridel4 has joined #riscv
<meowray> sorear: thanks for the musl patch!
heat has quit [Ping timeout: 255 seconds]
<meowray> the code uses dyn[DT_CRELSZ] for the relocation count. iirc, calloc in prepare_lazy can be replaced with calloc(n, 3). this is to work around some applications, so not supporting CREL should be acceptable
Trifton has joined #riscv
mlw has joined #riscv
BootLayer has joined #riscv
<meowray> sorear: loop condition: byte >= 128. sleb_uleb cannot be used within the loop. outside the loop, do if (sign && byte & 64) tmp |= (size_t)-1 << shift;
fuwei has joined #riscv
junaid_ has joined #riscv
davidlt has joined #riscv
davidlt has quit [Remote host closed the connection]
davidlt has joined #riscv
naoki has joined #riscv
naoki has quit [Client Quit]
handsome_feng has joined #riscv
crossdev has joined #riscv
dh` has quit [Read error: Connection reset by peer]
khem has quit [Quit: Connection closed for inactivity]
bitoff has quit [Ping timeout: 260 seconds]
BootLayer has quit [Quit: Leaving]
luca_ has joined #riscv
crabbedhaloablut has quit []
JanC_ has joined #riscv
JanC has quit [Ping timeout: 260 seconds]
JanC_ is now known as JanC
luca_ is now known as OwlWizard
crabbedhaloablut has joined #riscv
bitoff has joined #riscv
bitoff has quit [Client Quit]
OwlWizard is now known as luca
luca is now known as Guest3597
handsome_feng has quit [Quit: Connection closed for inactivity]
davidlt has quit [Ping timeout: 252 seconds]
junaid_ has quit [Quit: Lost terminal]
khem has joined #riscv
Tenkawa has joined #riscv
Guest3597 is now known as OwlWizard
junaid_ has joined #riscv
taj has joined #riscv
taj has quit [Remote host closed the connection]
junaid_ has quit [Ping timeout: 264 seconds]
oaken-source has quit [Ping timeout: 264 seconds]
junaid_ has joined #riscv
oaken-source has joined #riscv
jn__ is now known as jn
BootLayer has joined #riscv
prabhakalad has quit [Quit: Konversation terminated!]
prabhakalad has joined #riscv
junaid_ has quit [Quit: Lost terminal]
elastic_dog has quit [Ping timeout: 245 seconds]
elastic_dog has joined #riscv
heat has joined #riscv
OwlWizard has quit [Quit: OwlWizard]
davidlt has joined #riscv
Leopold has quit [Ping timeout: 260 seconds]
Leopold has joined #riscv
junaid_ has joined #riscv
Stat_headcrabed has joined #riscv
psydroid has joined #riscv
balrog_ is now known as balrog
crossdev has quit [Remote host closed the connection]
EchelonX has joined #riscv
Guest95 has joined #riscv
Guest95 has quit [Client Quit]
___nick___ has joined #riscv
junaid_ has quit [Quit: Lost terminal]
junaid_ has joined #riscv
KREYREN has joined #riscv
heat has quit [Remote host closed the connection]
___nick___ has quit [Ping timeout: 245 seconds]
___nick___ has joined #riscv
<sorear> meowray: i don't follow
<meowray> sorear: get_leb128 is incorrect. (1) the loop stop condition is while (byte >= 128) (2) the use of sleb_uleb in the loop does not correctly handle sign extension
<sorear> i grant that the loop condition is backward, when does it fail to correctly sign extend? (byte - 128*(byte >= 64)) only comes out negative if byte is [64,127], which is only possible for the last byte
Tenkawa has quit [Quit: Was I really ever here?]
khem has quit []
<meowray> sorear: initial bytes can be in the range [64,128) as well, not just the last byte
khem has joined #riscv
<sorear> meowray: what's an example of a leb128 sequence where a byte which is not the last byte is less than 128?
Leopold has quit [Ping timeout: 260 seconds]
<meowray> sorear: sorry, my description of (2) is wrong. get_leb128 is correct once the loop condition is fixed
Leopold has joined #riscv
<meowray> clever use of sleb_uleb!
<meowray> i think `tmp |=` is more idiomatic than `tmp +=` ?
<sorear> I couldn't say, although in the spirit of excessive cleverness ADD is likely to be shorter than OR on thumb or rvc
<sorear> pretty sure they're the same on s390x, i386, and sh and I never bothered to learn microMIPS at that level
dh` has joined #riscv
<meowray> i don't see a difference on godbolt using "ARM GCC thunk" -mthumb and "RISC-V rv64gc clang"
KREYREN has quit [Remote host closed the connection]
KREYREN has joined #riscv
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #riscv
Perflosopher has quit [Quit: Ping timeout (120 seconds)]
Perflosopher has joined #riscv
KREYREN has quit [Remote host closed the connection]
Stat_headcrabed has quit [Ping timeout: 245 seconds]
heat has joined #riscv
crossdev has joined #riscv
dramforever[m] has quit [Quit: Idle timeout reached: 172800s]
davidlt has quit [Ping timeout: 264 seconds]
vgtw has quit [Quit: ZNC - https://znc.in]
KREYREN has joined #riscv
KREYREN has quit [Remote host closed the connection]
KREYREN has joined #riscv
KREYREN has quit [Remote host closed the connection]
heat has quit [Remote host closed the connection]
heat has joined #riscv
KREYREN has joined #riscv
Narrat has joined #riscv
KREYREN has quit [Remote host closed the connection]
KREYREN has joined #riscv
KREYREN has quit [Remote host closed the connection]
Stat_headcrabed has joined #riscv
BootLayer has quit [Quit: Leaving]
foxbat has quit [Quit: bye]
Gravis has quit [Ping timeout: 252 seconds]
Gravis has joined #riscv
crossdev has quit [Remote host closed the connection]
crossdev has joined #riscv
mlw has quit [Ping timeout: 245 seconds]
prabhakalad has quit [Ping timeout: 245 seconds]
prabhakalad has joined #riscv
foxbat has joined #riscv
Stat_headcrabed has quit [Quit: Stat_headcrabed]
zjason` has joined #riscv
JanC has quit [Ping timeout: 264 seconds]
zjason has quit [Ping timeout: 272 seconds]
Leopold has quit [Ping timeout: 260 seconds]
Leopold has joined #riscv
JanC has joined #riscv
___nick___ has quit [Ping timeout: 268 seconds]
Leopold has quit [Remote host closed the connection]
Leopold has joined #riscv
crossdev has quit [Remote host closed the connection]
Leopold has quit [Remote host closed the connection]
Leopold has joined #riscv
naoki has joined #riscv
naoki has quit [Client Quit]
Leopold has quit [Ping timeout: 260 seconds]
Leopold has joined #riscv
Leopold has quit [Excess Flood]
Leopold has joined #riscv
DesRoin has quit [Ping timeout: 256 seconds]
vagrantc has joined #riscv
junaid_ has quit [Remote host closed the connection]
Leopold has quit [Ping timeout: 260 seconds]
Leopold has joined #riscv
Leopold has quit [Ping timeout: 260 seconds]
Leopold has joined #riscv
Leopold has quit [Excess Flood]
Leopold has joined #riscv
psydroid has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/]
Leopold has quit [Ping timeout: 260 seconds]
Leopold has joined #riscv
naoki has joined #riscv
motherfsck has quit [Ping timeout: 245 seconds]
Leopold has quit [Ping timeout: 260 seconds]
Leopold has joined #riscv
heat has quit [Remote host closed the connection]
Leopold has quit [Remote host closed the connection]
Leopold has joined #riscv
ntwk has quit [Ping timeout: 255 seconds]
djdelorie has quit [Ping timeout: 272 seconds]