MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::plug::math Namespace Reference

The math Plugin More...

Enumerations

%math.F
enum class  F : flags_t
%math.f16
enum class  f16 : flags_t
enum class  F16 : flags_t
%math.f32
enum class  f32 : flags_t
enum class  F32 : flags_t
%math.f64
enum class  f64 : flags_t
enum class  F64 : flags_t
%math.bf16
enum class  bf16 : flags_t
enum class  BF16 : flags_t
%math.nvtf32
enum class  nvtf32 : flags_t
enum class  NVTF32 : flags_t
%math.amdfp24
enum class  amdfp24 : flags_t
enum class  AMDFP24 : flags_t
%math.pxr24
enum class  pxr24 : flags_t
enum class  PXR24 : flags_t
%math.mode
enum class  mode : flags_t {
  none = 0x3825490000000f00 ,
  nnan = 0x3825490000000f01 ,
  ninf = 0x3825490000000f02 ,
  nsz = 0x3825490000000f03 ,
  arcp = 0x3825490000000f04 ,
  contract = 0x3825490000000f05 ,
  afn = 0x3825490000000f06 ,
  reassoc = 0x3825490000000f07 ,
  finite = 0x3825490000000f08 ,
  unsafe = 0x3825490000000f09 ,
  fast = 0x3825490000000f0a
}
%math.minus
enum class  minus : flags_t
%math.is_finite
enum class  is_finite : flags_t
%math.slf
enum class  slf : flags_t
%math.sgn
enum class  sgn : flags_t
%math.rrt
enum class  rrt : flags_t

Functions

void register_normalizers (Normalizers &normalizers)
math.F
const Deftype_f (const Def *pe)
const Deftype_f (World &w, nat_t p, nat_t e)
template<nat_t P, nat_t E>
auto match_f (const Def *def)
auto match_f16 (const Def *def)
auto match_f32 (const Def *def)
auto match_f64 (const Def *def)
std::optional< nat_tisa_f (const Def *def)
template<class R>
const Litlit_f (World &w, R val)
const Litlit_f (World &w, nat_t width, mim::f64 val)
math.arith
const Defop_rminus (VMode m, const Def *a)

Variables

static constexpr plugin_t Plugin_Id = 0x3825490000000000

Mode

enum class  Mode : nat_t {
  top = 0 ,
  none = top ,
  nnan = 1 << 0 ,
  ninf = 1 << 1 ,
  nsz = 1 << 2 ,
  arcp = 1 << 3 ,
  contract = 1 << 4 ,
  afn = 1 << 5 ,
  reassoc = 1 << 6 ,
  finite = nnan | ninf ,
  unsafe = nsz | arcp | reassoc ,
  fast ,
  bot = fast
}
 Allowed optimizations for a specific operation. More...
using VMode = std::variant<Mode, nat_t, const Def*>
 Give Mode as mim::plug::math::Mode, mim::nat_t or const Def*.
const Defmode (World &w, VMode m)
 mim::plug::math::VMode -> const Def*.

%math.arith

enum class  arith : flags_t {
  add = 0x3825490000001000 ,
  sub = 0x3825490000001001 ,
  mul = 0x3825490000001002 ,
  div = 0x3825490000001003 ,
  rem = 0x3825490000001004
}
template<arith id>
const Defnormalize_arith (const Def *type, const Def *c, const Def *arg)

%math.extrema

enum class  extrema : flags_t {
  im = 0x3825490000001200 ,
  fmin = 0x3825490000001200 ,
  iM = 0x3825490000001201 ,
  fmax = 0x3825490000001201 ,
  Im = 0x3825490000001202 ,
  ieee754min = 0x3825490000001202 ,
  IM = 0x3825490000001203 ,
  ieee754max = 0x3825490000001203
}
template<extrema id>
const Defnormalize_extrema (const Def *type, const Def *c, const Def *arg)

%math.tri

enum class  tri : flags_t {
  ahff = 0x3825490000001300 ,
  sin = 0x3825490000001300 ,
  ahfF = 0x3825490000001301 ,
  cos = 0x3825490000001301 ,
  ahFf = 0x3825490000001302 ,
  tan = 0x3825490000001302 ,
  ahFF = 0x3825490000001303 ,
  aHff = 0x3825490000001304 ,
  sinh = 0x3825490000001304 ,
  h = 0x3825490000001304 ,
  aHfF = 0x3825490000001305 ,
  cosh = 0x3825490000001305 ,
  aHFf = 0x3825490000001306 ,
  tanh = 0x3825490000001306 ,
  aHFF = 0x3825490000001307 ,
  Ahff = 0x3825490000001308 ,
  asin = 0x3825490000001308 ,
  a = 0x3825490000001308 ,
  AhfF = 0x3825490000001309 ,
  acos = 0x3825490000001309 ,
  AhFf = 0x382549000000130a ,
  atan = 0x382549000000130a ,
  AhFF = 0x382549000000130b ,
  AHff = 0x382549000000130c ,
  asinh = 0x382549000000130c ,
  AHfF = 0x382549000000130d ,
  acosh = 0x382549000000130d ,
  AHFf = 0x382549000000130e ,
  atanh = 0x382549000000130e ,
  AHFF = 0x382549000000130f
}
template<tri id>
const Defnormalize_tri (const Def *type, const Def *, const Def *arg)

%math.pow

enum class  pow : flags_t
const Defnormalize_pow (const Def *type, const Def *, const Def *arg)

%math.rt

enum class  rt : flags_t {
  sq = 0x3825490000001500 ,
  cb = 0x3825490000001501
}
template<rt id>
const Defnormalize_rt (const Def *type, const Def *, const Def *arg)

%math.exp

enum class  exp : flags_t {
  lbb = 0x3825490000001600 ,
  exp = 0x3825490000001600 ,
  lbB = 0x3825490000001601 ,
  exp2 = 0x3825490000001601 ,
  bin = 0x3825490000001601 ,
  lBb = 0x3825490000001602 ,
  exp10 = 0x3825490000001602 ,
  dec = 0x3825490000001602 ,
  lBB = 0x3825490000001603 ,
  Lbb = 0x3825490000001604 ,
  log = 0x3825490000001604 ,
  LbB = 0x3825490000001605 ,
  log2 = 0x3825490000001605 ,
  LBb = 0x3825490000001606 ,
  log10 = 0x3825490000001606 ,
  LBB = 0x3825490000001607
}
template<exp id>
const Defnormalize_exp (const Def *type, const Def *, const Def *arg)

%math.er

enum class  er : flags_t {
  f = 0x3825490000001700 ,
  fc = 0x3825490000001701
}
template<er id>
const Defnormalize_er (const Def *type, const Def *, const Def *arg)

%math.gamma

enum class  gamma : flags_t {
  t = 0x3825490000001800 ,
  l = 0x3825490000001801
}
template<gamma id>
const Defnormalize_gamma (const Def *type, const Def *, const Def *arg)

%math.abs

enum class  abs : flags_t
const Defnormalize_abs (const Def *type, const Def *, const Def *arg)

%math.round

enum class  round : flags_t {
  f = 0x3825490000001a00 ,
  c = 0x3825490000001a01 ,
  r = 0x3825490000001a02 ,
  t = 0x3825490000001a03
}
template<round id>
const Defnormalize_round (const Def *type, const Def *, const Def *arg)

%math.cmp

enum class  cmp : flags_t {
  ugle = 0x3825490000001b00 ,
  f = 0x3825490000001b00 ,
  uglE = 0x3825490000001b01 ,
  e = 0x3825490000001b01 ,
  ugLe = 0x3825490000001b02 ,
  l = 0x3825490000001b02 ,
  ugLE = 0x3825490000001b03 ,
  le = 0x3825490000001b03 ,
  uGle = 0x3825490000001b04 ,
  g = 0x3825490000001b04 ,
  uGlE = 0x3825490000001b05 ,
  ge = 0x3825490000001b05 ,
  uGLe = 0x3825490000001b06 ,
  ne = 0x3825490000001b06 ,
  uGLE = 0x3825490000001b07 ,
  o = 0x3825490000001b07 ,
  Ugle = 0x3825490000001b08 ,
  u = 0x3825490000001b08 ,
  UglE = 0x3825490000001b09 ,
  ue = 0x3825490000001b09 ,
  UgLe = 0x3825490000001b0a ,
  ul = 0x3825490000001b0a ,
  UgLE = 0x3825490000001b0b ,
  ule = 0x3825490000001b0b ,
  UGle = 0x3825490000001b0c ,
  ug = 0x3825490000001b0c ,
  UGlE = 0x3825490000001b0d ,
  uge = 0x3825490000001b0d ,
  UGLe = 0x3825490000001b0e ,
  une = 0x3825490000001b0e ,
  UGLE = 0x3825490000001b0f ,
  t = 0x3825490000001b0f
}
template<cmp id>
const Defnormalize_cmp (const Def *type, const Def *c, const Def *arg)

%math.conv

enum class  conv : flags_t {
  s2f = 0x3825490000001d00 ,
  u2f = 0x3825490000001d01 ,
  f2s = 0x3825490000001d02 ,
  f2u = 0x3825490000001d03 ,
  f2f = 0x3825490000001d04
}
template<conv id>
const Defnormalize_conv (const Def *dst_t, const Def *, const Def *x)

Detailed Description

Typedef Documentation

◆ VMode

using mim::plug::math::VMode = std::variant<Mode, nat_t, const Def*>

Give Mode as mim::plug::math::Mode, mim::nat_t or const Def*.

Definition at line 43 of file math.h.

Enumeration Type Documentation

◆ abs

enum class mim::plug::math::abs : flags_t
strong

Definition at line 287 of file autogen.h.

◆ AMDFP24

enum class mim::plug::math::AMDFP24 : flags_t
strong

Definition at line 105 of file autogen.h.

◆ amdfp24

enum class mim::plug::math::amdfp24 : flags_t
strong

Definition at line 56 of file autogen.h.

◆ arith

enum class mim::plug::math::arith : flags_t
strong
Enumerator
add 
sub 
mul 
div 
rem 

Definition at line 137 of file autogen.h.

◆ BF16

enum class mim::plug::math::BF16 : flags_t
strong

Definition at line 91 of file autogen.h.

◆ bf16

enum class mim::plug::math::bf16 : flags_t
strong

Definition at line 42 of file autogen.h.

◆ cmp

enum class mim::plug::math::cmp : flags_t
strong
Enumerator
ugle 
uglE 
ugLe 
ugLE 
le 
uGle 
uGlE 
ge 
uGLe 
ne 
uGLE 
Ugle 
UglE 
ue 
UgLe 
ul 
UgLE 
ule 
UGle 
ug 
UGlE 
uge 
UGLe 
une 
UGLE 

Definition at line 309 of file autogen.h.

◆ conv

enum class mim::plug::math::conv : flags_t
strong
Enumerator
s2f 
u2f 
f2s 
f2u 
f2f 

Definition at line 358 of file autogen.h.

◆ er

enum class mim::plug::math::er : flags_t
strong
Enumerator
fc 

Definition at line 263 of file autogen.h.

◆ exp

enum class mim::plug::math::exp : flags_t
strong
Enumerator
lbb 
exp 
lbB 
exp2 
bin 
lBb 
exp10 
dec 
lBB 
Lbb 
log 
LbB 
log2 
LBb 
log10 
LBB 

Definition at line 237 of file autogen.h.

◆ extrema

enum class mim::plug::math::extrema : flags_t
strong
Enumerator
im 
fmin 
iM 
fmax 
Im 
ieee754min 
IM 
ieee754max 

Definition at line 159 of file autogen.h.

◆ F

enum class mim::plug::math::F : flags_t
strong

Definition at line 14 of file autogen.h.

◆ F16

enum class mim::plug::math::F16 : flags_t
strong

Definition at line 70 of file autogen.h.

◆ f16

enum class mim::plug::math::f16 : flags_t
strong

Definition at line 21 of file autogen.h.

◆ F32

enum class mim::plug::math::F32 : flags_t
strong

Definition at line 77 of file autogen.h.

◆ f32

enum class mim::plug::math::f32 : flags_t
strong

Definition at line 28 of file autogen.h.

◆ F64

enum class mim::plug::math::F64 : flags_t
strong

Definition at line 84 of file autogen.h.

◆ f64

enum class mim::plug::math::f64 : flags_t
strong

Definition at line 35 of file autogen.h.

◆ gamma

enum class mim::plug::math::gamma : flags_t
strong
Enumerator

Definition at line 275 of file autogen.h.

◆ is_finite

enum class mim::plug::math::is_finite : flags_t
strong

Definition at line 351 of file autogen.h.

◆ minus

enum class mim::plug::math::minus : flags_t
strong

Definition at line 152 of file autogen.h.

◆ Mode

enum class mim::plug::math::Mode : nat_t
strong

Allowed optimizations for a specific operation.

Enumerator
top 
none 

Alias for Mode::none.

nnan 

No NaNs.

Allow optimizations to assume the arguments and result are not NaN. Such optimizations are required to retain defined behavior over NaNs, but the value of the result is undefined.

ninf 

No Infs.

Allow optimizations to assume the arguments and result are not +/-Inf. Such optimizations are required to retain defined behavior over +/-Inf, but the value of the result is undefined.

nsz 

No Signed Zeros.

Allow optimizations to treat the sign of a zero argument or result as insignificant.

arcp 

Allow Reciprocal.

Allow optimizations to use the reciprocal of an argument rather than perform division.

contract 

Allow floating-point contraction (e.g.

fusing a multiply followed by an addition into a fused multiply-and-add).

afn 

Approximate functions.

Allow substitution of approximate calculations for functions (sin, log, sqrt, etc).

reassoc 

Allow reassociation transformations for floating-point operations.

This may dramatically change results in floating point.

finite 

Mode::nnan | Mode::ninf.

unsafe 

Mode::nsz | Mode::arcp | Mode::reassoc.

fast 

All flags.

bot 

Alias for Mode::fast.

Definition at line 14 of file math.h.

◆ mode

enum class mim::plug::math::mode : flags_t
strong
Enumerator
none 
nnan 
ninf 
nsz 
arcp 
contract 
afn 
reassoc 
finite 
unsafe 
fast 

Definition at line 119 of file autogen.h.

◆ NVTF32

enum class mim::plug::math::NVTF32 : flags_t
strong

Definition at line 98 of file autogen.h.

◆ nvtf32

enum class mim::plug::math::nvtf32 : flags_t
strong

Definition at line 49 of file autogen.h.

◆ pow

enum class mim::plug::math::pow : flags_t
strong

Definition at line 217 of file autogen.h.

◆ PXR24

enum class mim::plug::math::PXR24 : flags_t
strong

Definition at line 112 of file autogen.h.

◆ pxr24

enum class mim::plug::math::pxr24 : flags_t
strong

Definition at line 63 of file autogen.h.

◆ round

enum class mim::plug::math::round : flags_t
strong
Enumerator

Definition at line 295 of file autogen.h.

◆ rrt

enum class mim::plug::math::rrt : flags_t
strong

Definition at line 387 of file autogen.h.

◆ rt

enum class mim::plug::math::rt : flags_t
strong
Enumerator
sq 
cb 

Definition at line 225 of file autogen.h.

◆ sgn

enum class mim::plug::math::sgn : flags_t
strong

Definition at line 380 of file autogen.h.

◆ slf

enum class mim::plug::math::slf : flags_t
strong

Definition at line 373 of file autogen.h.

◆ tri

enum class mim::plug::math::tri : flags_t
strong
Enumerator
ahff 
sin 
ahfF 
cos 
ahFf 
tan 
ahFF 
aHff 
sinh 
aHfF 
cosh 
aHFf 
tanh 
aHFF 
Ahff 
asin 
AhfF 
acos 
AhFf 
atan 
AhFF 
AHff 
asinh 
AHfF 
acosh 
AHFf 
atanh 
AHFF 

Definition at line 177 of file autogen.h.

Function Documentation

◆ isa_f()

std::optional< nat_t > mim::plug::math::isa_f ( const Def * def)
inline

Definition at line 77 of file math.h.

References mim::Axm::isa(), and isa_f().

Referenced by isa_f(), normalize_arith(), normalize_conv(), mim::plug::core::normalize_trait(), and op_rminus().

◆ lit_f() [1/2]

const Lit * mim::plug::math::lit_f ( World & w,
nat_t width,
mim::f64 val )
inline

Definition at line 98 of file math.h.

References lit_f().

◆ lit_f() [2/2]

template<class R>
const Lit * mim::plug::math::lit_f ( World & w,
R val )

Definition at line 90 of file math.h.

References lit_f().

Referenced by lit_f(), lit_f(), normalize_arith(), and op_rminus().

◆ match_f()

template<nat_t P, nat_t E>
auto mim::plug::math::match_f ( const Def * def)
inline

Definition at line 65 of file math.h.

References mim::Axm::isa(), mim::Lit::isa(), and match_f().

Referenced by match_f(), match_f16(), match_f32(), and match_f64().

◆ match_f16()

auto mim::plug::math::match_f16 ( const Def * def)
inline

Definition at line 73 of file math.h.

References match_f(), and match_f16().

Referenced by match_f16().

◆ match_f32()

auto mim::plug::math::match_f32 ( const Def * def)
inline

Definition at line 74 of file math.h.

References match_f(), and match_f32().

Referenced by match_f32().

◆ match_f64()

auto mim::plug::math::match_f64 ( const Def * def)
inline

Definition at line 75 of file math.h.

References match_f(), and match_f64().

Referenced by match_f64().

◆ mode()

const Def * mim::plug::math::mode ( World & w,
VMode m )
inline

mim::plug::math::VMode -> const Def*.

Definition at line 46 of file math.h.

◆ normalize_abs()

const Def * mim::plug::math::normalize_abs ( const Def * type,
const Def * ,
const Def * arg )

Definition at line 516 of file normalizers.cpp.

References normalize_abs().

Referenced by normalize_abs().

◆ normalize_arith()

template<arith id>
const Def * mim::plug::math::normalize_arith ( const Def * type,
const Def * c,
const Def * arg )

Definition at line 346 of file normalizers.cpp.

References add, c, div, fast, mim::Lit::isa(), isa_f(), lit_f(), mul, normalize_arith(), mim::Def::projs(), rem, and sub.

Referenced by normalize_arith().

◆ normalize_cmp()

template<cmp id>
const Def * mim::plug::math::normalize_cmp ( const Def * type,
const Def * c,
const Def * arg )

Definition at line 479 of file normalizers.cpp.

References c, f, normalize_cmp(), mim::Def::projs(), and t.

Referenced by normalize_cmp().

◆ normalize_conv()

template<conv id>
const Def * mim::plug::math::normalize_conv ( const Def * dst_t,
const Def * ,
const Def * x )

◆ normalize_er()

template<er id>
const Def * mim::plug::math::normalize_er ( const Def * type,
const Def * ,
const Def * arg )

Definition at line 465 of file normalizers.cpp.

References normalize_er().

Referenced by normalize_er().

◆ normalize_exp()

template<exp id>
const Def * mim::plug::math::normalize_exp ( const Def * type,
const Def * ,
const Def * arg )

Definition at line 458 of file normalizers.cpp.

References normalize_exp().

Referenced by normalize_exp().

◆ normalize_extrema()

template<extrema id>
const Def * mim::plug::math::normalize_extrema ( const Def * type,
const Def * c,
const Def * arg )

◆ normalize_gamma()

template<gamma id>
const Def * mim::plug::math::normalize_gamma ( const Def * type,
const Def * ,
const Def * arg )

Definition at line 472 of file normalizers.cpp.

References normalize_gamma().

Referenced by normalize_gamma().

◆ normalize_pow()

const Def * mim::plug::math::normalize_pow ( const Def * type,
const Def * ,
const Def * arg )

Definition at line 443 of file normalizers.cpp.

References normalize_pow(), and mim::Def::projs().

Referenced by normalize_pow().

◆ normalize_round()

template<round id>
const Def * mim::plug::math::normalize_round ( const Def * type,
const Def * ,
const Def * arg )

Definition at line 523 of file normalizers.cpp.

References normalize_round().

Referenced by normalize_round().

◆ normalize_rt()

template<rt id>
const Def * mim::plug::math::normalize_rt ( const Def * type,
const Def * ,
const Def * arg )

Definition at line 451 of file normalizers.cpp.

References normalize_rt().

Referenced by normalize_rt().

◆ normalize_tri()

template<tri id>
const Def * mim::plug::math::normalize_tri ( const Def * type,
const Def * ,
const Def * arg )

Definition at line 437 of file normalizers.cpp.

References normalize_tri().

Referenced by normalize_tri().

◆ op_rminus()

const Def * mim::plug::math::op_rminus ( VMode m,
const Def * a )
inline

Definition at line 113 of file math.h.

References isa_f(), lit_f(), op_rminus(), and sub.

Referenced by op_rminus().

◆ register_normalizers()

void mim::plug::math::register_normalizers ( Normalizers & normalizers)

◆ type_f() [1/2]

const Def * mim::plug::math::type_f ( const Def * pe)
inline

Definition at line 55 of file math.h.

References type_f().

Referenced by type_f(), and type_f().

◆ type_f() [2/2]

const Def * mim::plug::math::type_f ( World & w,
nat_t p,
nat_t e )
inline

Definition at line 59 of file math.h.

References type_f().

Variable Documentation

◆ Plugin_Id

plugin_t mim::plug::math::Plugin_Id = 0x3825490000000000
staticconstexpr

Definition at line 10 of file autogen.h.