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

A.2.3 Mixed GP / FP Extern Intrinsics

The x86_64 backend supports mixed integer/pointer and floating-point extern calls through the intrinsic family:

__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
  • 1 means treat the low 32 bits of valueN as raw f32 bits and pass them in the next XMM argument register
  • 2 means treat all 64 bits of valueN as raw f64 bits and pass them in the next XMM argument register

This backend also provides:

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

These convert a signed integer value into IEEE-754 f32 / f64 bit patterns, returned as ordinary udewy integers. __f32_bits_to_i64__ and __f64_bits_to_i64__ perform the reverse direction for values containing f32 / f64 bit patterns.