# module Intrinsics

##
Defined in:

intrinsics.cr

##
Class Method Summary

- .bitreverse128(id) : UInt128
- .bitreverse16(id) : UInt16
- .bitreverse32(id) : UInt32
- .bitreverse64(id) : UInt64
- .bitreverse8(id) : UInt8
- .bswap128(id) : UInt128
- .bswap16(id) : UInt16
- .bswap32(id) : UInt32
- .bswap64(id) : UInt64
- .fshl128(a, b, count) : UInt128
- .fshl16(a, b, count) : UInt16
- .fshl32(a, b, count) : UInt32
- .fshl64(a, b, count) : UInt64
- .fshl8(a, b, count) : UInt8
- .fshr128(a, b, count) : UInt128
- .fshr16(a, b, count) : UInt16
- .fshr32(a, b, count) : UInt32
- .fshr64(a, b, count) : UInt64
- .fshr8(a, b, count) : UInt8
- .pause
- .popcount128(src)
- .popcount16(src) : Int16
- .popcount32(src) : Int32
- .popcount64(src) : Int64
- .popcount8(src) : Int8
- .read_cycle_counter
- .unreachable : NoReturn

  Should codegen to the following LLVM IR (before being inlined): `define internal void @"*Intrinsics::unreachable:NoReturn"() #12 { entry: unreachable }`

##
Macro Summary

- countleading128(src, zero_is_undef)
- countleading16(src, zero_is_undef)
- countleading32(src, zero_is_undef)
- countleading64(src, zero_is_undef)
- countleading8(src, zero_is_undef)
- counttrailing128(src, zero_is_undef)
- counttrailing16(src, zero_is_undef)
- counttrailing32(src, zero_is_undef)
- counttrailing64(src, zero_is_undef)
- counttrailing8(src, zero_is_undef)
- debugtrap
- memcpy(dest, src, len, is_volatile)
- memmove(dest, src, len, is_volatile)
- memset(dest, val, len, is_volatile)
- va_end(ap)
- va_start(ap)

##
Class Method Detail

def self.bitreverse128(id) : UInt128 #
def self.bitreverse16(id) : UInt16 #
def self.bitreverse32(id) : UInt32 #
def self.bitreverse64(id) : UInt64 #
def self.bitreverse8(id) : UInt8 #
def self.bswap128(id) : UInt128 #
def self.bswap16(id) : UInt16 #
def self.bswap32(id) : UInt32 #
def self.bswap64(id) : UInt64 #
def self.fshl128(a, b, count) : UInt128 #
def self.fshl16(a, b, count) : UInt16 #
def self.fshl32(a, b, count) : UInt32 #
def self.fshl64(a, b, count) : UInt64 #
def self.fshl8(a, b, count) : UInt8 #
def self.fshr128(a, b, count) : UInt128 #
def self.fshr16(a, b, count) : UInt16 #
def self.fshr32(a, b, count) : UInt32 #
def self.fshr64(a, b, count) : UInt64 #
def self.fshr8(a, b, count) : UInt8 #
def self.pause #
def self.popcount128(src) #
def self.popcount16(src) : Int16 #
def self.popcount32(src) : Int32 #
def self.popcount64(src) : Int64 #
def self.popcount8(src) : Int8 #
def self.read_cycle_counter #
def self.unreachable : NoReturn #

Should codegen to the following LLVM IR (before being inlined):

    define internal void @"*Intrinsics::unreachable:NoReturn"() #12 {
    entry:
      unreachable
    }

Can be used like `@llvm.assume(i1 cond)` as `unreachable unless (assumption)`.

WARNING the behaviour of the program is undefined if the assumption is broken!

##
Macro Detail

macro countleading128(src, zero_is_undef) #
macro countleading16(src, zero_is_undef) #
macro countleading32(src, zero_is_undef) #
macro countleading64(src, zero_is_undef) #
macro countleading8(src, zero_is_undef) #
macro counttrailing128(src, zero_is_undef) #
macro counttrailing16(src, zero_is_undef) #
macro counttrailing32(src, zero_is_undef) #
macro counttrailing64(src, zero_is_undef) #
macro counttrailing8(src, zero_is_undef) #
macro debugtrap #
macro memcpy(dest, src, len, is_volatile) #
macro memmove(dest, src, len, is_volatile) #
macro memset(dest, val, len, is_volatile) #
macro va_end(ap) #
macro va_start(ap) #