Skip to main content
12 events
when toggle format what by license comment
Feb 8, 2022 at 16:28 history edited Peter Cordes CC BY-SA 4.0
I knew I'd written an answer about removed instructions / opcodes in x86-64; it also mentions LAHF
Feb 8, 2022 at 16:25 comment added Peter Cordes @ecm: that's correct; 64-bit mode cleaned up the opcode coding space a bit for future 64-bit-only extensions, which Intel has unfortunately been reluctant to take advantage of. Still wasting code-size cramming things like EVEX prefixes into patterns that aren't valid 32-bit encodings. What I said wasn't wrong, since modern CPUs are still required to support 16 and 32-bit modes, but it is useful to clarify, thanks. For actual codegolf.SE purposes, it's sufficient that 64-bit lahf/sahf are available on some implementations, and fuz's linked answer mentions that along with the BCD insns.
Feb 8, 2022 at 16:19 history edited Peter Cordes CC BY-SA 4.0
64-bit modes has dropped a few. Since I hate using x86 to mean 32-bit mode, fix that.
Feb 8, 2022 at 16:06 comment added ecm "1-byte lahf / sahf are rarely useful." - "current x86 hasn't dropped any of 8086's opcodes" - Actually, these two are not available on some amd64 implementations when in a 64-bit code segment. Apparently the das/daa/etc type instructions are also (always) unavailable in 64-bit segments.
Sep 7, 2021 at 18:59 history edited Peter Cordes CC BY-SA 4.0
A use for DAS
Sep 7, 2021 at 18:47 comment added Peter Cordes @ecm: There's a 5-byte / 3-instruction hack using DAS (which I didn't know about when I wrote this answer), suggested by @ peter ferrie. I described how/why it works in Little Endian Number to String Conversion
Sep 7, 2021 at 15:03 comment added ecm "I've also never found a use for AAA / DAA or other packed-BCD or 2-ASCII-digit instructions." Here's an example of converting a number to an ASCII hex digit codepoint. I golfed this at some point and found several choices, none of which were shorter than this sequence.
Apr 14, 2018 at 23:30 history edited Peter Cordes CC BY-SA 3.0
added 264 characters in body
Apr 14, 2018 at 21:17 comment added Peter Cordes @qwr: right, you can abuse cdq before unsigned div if you know your dividend is below 2^31 (i.e. non-negative when treated as signed), or if you use it before setting eax to a potentially-large value. Normally (outside code-golf) you'd use cdq as setup for idiv, and xor edx,edx before div
Apr 14, 2018 at 16:50 comment added qwr cdq is useful for div which needs zeroed edx in many cases.
Mar 30, 2018 at 17:44 history edited Peter Cordes CC BY-SA 3.0
added 137 characters in body
Mar 29, 2018 at 20:44 history answered Peter Cordes CC BY-SA 3.0