Panther Search Documentation Tutorials Devlogs Downloads Source Code

Documentation > Panther Documentation > Intrinsics

Intrinsics

Panther
Documentation


  Instrinsics are special symbols builtin to the compiler. They are all either begin with an @ or are part of a builtin module (which itself begins with an @).

  Intrinsic functions are almost always inlined and some (such as type trait intrinsics) don't have any runtime execution at all. As such, you cannot take the address of an intrinsic function.

Intrinsic Functions

Importing

@import Import a Panther file
@importC Import a C file
@importCpp Import a C++ file

Operational

@abort Abort the program
@breakpoint Cause an execution trap to request the debugger break execution
@makeInitPtr Converts an uninitialized-qualified pointer to a pointer

Intrinsic functions for Internal Use

  These intrinsic functions are meant for internal use by the standard library. All functionality of these functions can be found in the standard library and/or in the language itself.

Atomic

@atomicLoad Atomically load a value
@atomicStore Atomically store a value
@atomicRMW Atomic read-modify-write
@cmpxchg Atomic compare-exchange

Arithmetic

@add Integer addition
@addWrap Integer addition that returns if operation wrapped
@addSat Integer saturating addition
@fadd Floating-point addition
@sub Integer subtraction
@subWrap Integer subtraction that returns if operation wrapped
@subSat Integer saturating subtraction
@fsub Floating-point subtraction
@mul Integer multiplication
@mulWrap Integer multiplication that returns if operation wrapped
@mulSat Integer saturating multiplication
@fmul Floating-point multiplication
@div Integer division
@fdiv Floating-point division
@rem Division remainder
@fneg Floating-point negation

Bitwise

@and Bitwise and
@or Bitwise or
@xor Bitwise xor
@shl Bitwise shift left
@shlSat Bitwise saturating shift left
@shr Bitwise saturating shift left
@bitReverse Reverse the bits
@byteSwap Swap the bytes
@ctPop Count the number of one bits
@ctlz Count the number of leading zero bits
@cttz Count the number of trailing zero bits

Comparative

@eq Calculate equality
@neq Calculate non-equality
@lt Calculate less than
@lte Calculate less than or equal to
@gt Calculate greater than
@gte Calculate greater than or equal to

Type Conversion

@bitCast Bitwise convert a value of any type to any other tpe of the same size
@trunc Truncate any integral type to any other smaller integral type
@ftrunc Truncate any floating-point type to any other smaller floating-point type
@sext Sign extend any integral type to any other larger integral type
@zext Zero extend any integral type to any other larger integral type
@fext Extend any floating-point type to any other larger floating-point type
@iToF Convert any integral type to any floating-point type
@fToI Convert any floating-point type to any integral type

Type Traits

@getTypeID Get the TypeID of a type
@arrayElementTypeID Get the TypeID of the elements of an array type
@arrayRefElementTypeID Get the TypeID of the elements of an array reference type
@numBytes Get the number of bytes of TypeID
@numBits Get the number of bits of TypeID

Intrinsic modules for Internal Use

  These intrinsic modules contain types that are helpers for intrinsics meant for internal use by the standard library.

@pthr

@build