Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

B.2.3 Mixed GP / FP Extern Intrinsics

The RISC-V backend supports the same mixed integer/pointer and floating-point extern call intrinsic family as the other native Linux backends:

__call_extern_mixed_1__(fn type0 value0)
__call_extern_mixed_2__(fn type0 value0 type1 value1)
...
__call_extern_mixed_8__(fn type0 value0 ... type7 value7)

Rules:

  • fn is an extern function reference
  • each typeN must be a compile-time integer literal
  • 0 means pass valueN through the normal integer/pointer calling convention in a0-a7
  • 1 means treat the low 32 bits of valueN as raw f32 bits and pass them in the next floating-point argument register (fa0-fa7)
  • 2 means treat all 64 bits of valueN as raw f64 bits and pass them in the next floating-point argument register (fa0-fa7)

This backend also provides:

__i64_to_f32_bits__(value)
__i64_to_f64_bits__(value)
__f32_bits_to_i64__(value)
__f64_bits_to_i64__(value)

Integer-only udewy programs keep the backend's ordinary minimal RISC-V target assumptions. Using these FP conversion or mixed GP / FP extern intrinsics makes the generated artifact require a hard-float-capable RISC-V ABI/toolchain (LP64D-compatible). This is a whole-artifact requirement, not a per-call ABI switch.