What's your favorite weird CPU instruction? any architecture, any time period
twitter.com
twitter.com
HFC - Halt and Catch Fire
edit: thought it was branch and....corrected
https://x86.fr/investigating-the-halt-and-catch-fire-instruc...
I once used this to speed up text search by a few orders of magnitude in the days of MS-DOS. My search went from 30 seconds to scan 3 Megabytes to faster than disks could read it. (<3 seconds)
The past is truly a different world.
The computer only has one instruction, so I didn't bother to give the instruction a name. But it performs an input, an output and a 2-way branch. I hope this is weird enough to deserve mention in this thread. :)
The project was mentioned at least twice previously on HN:
other fun x86 ones:
CALL SP
will call whatever code has been pushed on the stack. Unlike PUSH SP, it works the same on 8086 and newer CPUs
RET -2 (16 bit; -4 or -8 for 32/64 bit)
return but leave address on stack
LAR
load access rights; doesn't trap to kernel, so you can use this in ring3 code to scan through segment selectors and find out which are accessible and what type they are. On any x64 Linux, you can switch between 32 and 64 bit modes via far call, and syscalls will work in both modes (though they use different numbers).
MOV -(PC),-(PC)
block register transfer - a contiguous block of registers to/from a contiguous block of memory
explicit cache manipulation (invalidate, validate w/o read, prefetch)
start a thread (Tera MTA)
full/empty bits on the MTA (read full blocks on empty memory until its filled)