‘mathExt’ Dialect

Extended Math dialect.

Operations

mathExt.ilogb (mathExt::IlogbOp)

An exponent components of a floating-point number

Syntax:

operation ::= `mathExt.ilogb` $operand (`fastmath` `` $fastmath^)?
              attr-dict `:` type($result)

ilogb(x) := floor(log2(abs(x)))

The ilogb operation takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. It has no standard attributes.

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType, Scalarizable, Tensorizable, Vectorizable

Interfaces: ArithFastMathInterface, ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface), VectorUnrollOpInterface

Effects: MemoryEffects::Effect{}

Attributes

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags{{% markdown %}}Enum cases: * none (`none`) * reassoc (`reassoc`) * nnan (`nnan`) * ninf (`ninf`) * nsz (`nsz`) * arcp (`arcp`) * contract (`contract`) * afn (`afn`) * fast (`fast`){{% /markdown %}}

Operands

Operand

Description

operand

floating-point-like

Results

Result

Description

result

floating-point-like

mathExt.ldep (mathExt::LdexpOp)

A fractional components of a floating-point number

Syntax:

operation ::= `mathExt.ldep` $lhs `,` $rhs (`fastmath` `` $fastmath^)?
              attr-dict `:` type($result)

ldep(x) = x * (ilogb(x) + 1)^(-1)

The ldexp operation takes two operands of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type. Operands must have the same type.

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType, Scalarizable, Tensorizable, Vectorizable

Interfaces: ArithFastMathInterface, ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface), VectorUnrollOpInterface

Effects: MemoryEffects::Effect{}

Attributes

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags{{% markdown %}}Enum cases: * none (`none`) * reassoc (`reassoc`) * nnan (`nnan`) * ninf (`ninf`) * nsz (`nsz`) * arcp (`arcp`) * contract (`contract`) * afn (`afn`) * fast (`fast`){{% /markdown %}}

Operands

Operand

Description

lhs

floating-point-like

rhs

floating-point-like

Results

Result

Description

result

floating-point-like

Enums

CmpFPredicate

allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

Cases

Symbol

Value

String

AlwaysFalse

0

false

OEQ

1

oeq

OGT

2

ogt

OGE

3

oge

OLT

4

olt

OLE

5

ole

ONE

6

one

ORD

7

ord

UEQ

8

ueq

UGT

9

ugt

UGE

10

uge

ULT

11

ult

ULE

12

ule

UNE

13

une

UNO

14

uno

AlwaysTrue

15

true

CmpIPredicate

allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Cases

Symbol

Value

String

eq

0

eq

ne

1

ne

slt

2

slt

sle

3

sle

sgt

4

sgt

sge

5

sge

ult

6

ult

ule

7

ule

ugt

8

ugt

uge

9

uge

IntegerOverflowFlags

Integer overflow arith flags

Cases

Symbol

Value

String

none

0

none

nsw

1

nsw

nuw

2

nuw

RoundingMode

Floating point rounding mode

Cases

Symbol

Value

String

to_nearest_even

0

to_nearest_even

downward

1

downward

upward

2

upward

toward_zero

3

toward_zero

to_nearest_away

4

to_nearest_away

AtomicRMWKind

allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14

Cases

Symbol

Value

String

addf

0

addf

addi

1

addi

assign

2

assign

maximumf

3

maximumf

maxs

4

maxs

maxu

5

maxu

minimumf

6

minimumf

mins

7

mins

minu

8

minu

mulf

9

mulf

muli

10

muli

ori

11

ori

andi

12

andi

maxnumf

13

maxnumf

minnumf

14

minnumf

FastMathFlags

Floating point fast math flags

Cases

Symbol

Value

String

none

0

none

reassoc

1

reassoc

nnan

2

nnan

ninf

4

ninf

nsz

8

nsz

arcp

16

arcp

contract

32

contract

afn

64

afn

fast

127

fast