Low-level Haskell: The cursed way to emulate inline assembly in Haskell/GHC, or how to return multiple values from a foreign function
Summary
An in-depth look at mimicking inline assembly in GHC Haskell using intrinsics, FFI, and foreign imports. It covers obtaining high and low halves of 64-bit products, multiple return values, and several approaches (pointers, SIMD, and primops) with benchmarks comparing performance. It also discusses portability, safety concerns, and GHC version caveats.