<dinuxbg>
zmatt: How would you write lt3_u16 more efficiently in assembly?
brook has joined #beagle
brook has quit [Read error: Connection reset by peer]
brook has joined #beagle
Stat_headcrabed has joined #beagle
brook_ has quit [Ping timeout: 260 seconds]
florian_kc has quit [Quit: Ex-Chat]
ikarso has joined #beagle
av500 has joined #beagle
Stat_headcrabed has quit [Quit: Stat_headcrabed]
brook has quit [Remote host closed the connection]
brook has joined #beagle
brook has quit [Read error: Connection reset by peer]
brook_ has joined #beagle
jfsimon1981 has quit [Read error: Connection reset by peer]
jfsimon1981_c has joined #beagle
jfsimon1981_c has quit [Max SendQ exceeded]
jfsimon1981 has joined #beagle
vagrantc has joined #beagle
josmiranda has quit [Quit: Client closed]
ikarso has quit [Quit: Connection closed for inactivity]
<zmatt>
dinuxbg: ((u32)x - 3) >> 31
<zmatt>
i.e.: sub tmp, r14.w0, 3 ; lsr r14.b0, tmp, 31 ; ret
<zmatt>
(where tmp may be r14)
<zmatt>
this works in general for (a < b) whenever the exact (non-wrapping) result of (a - b) is within INT_MIN .. INT_MAX
xet7 has joined #beagle
buzzmarshall has joined #beagle
brook_ has quit [Read error: Connection reset by peer]
brook has joined #beagle
brook has quit [Read error: Connection reset by peer]
brook_ has joined #beagle
<zmatt>
dinuxbg: also, for unsigned a,b (or more generally a,b known to be non-negative) you can use "sub" to set the carry-flag to (a >= b) and use that in various ways: https://pastebin.com/hcGqGv2L
<zmatt>
that yields a 4-instruction lt3_u16 (including ret) so less efficient than the above but still more efficient than gcc's version using a branch
<zmatt>
(hopefully I got this right, I didn't test it ;)
comicry has joined #beagle
comicry is now known as CrazyEddy
outrageous has joined #beagle
bryanb has quit [Remote host closed the connection]