MLIR

Multi-Level IR Compiler Framework

'complex' Dialect

The complex dialect is intended to hold complex numbers creation and arithmetic ops.

Operations 

source

complex.abs (complex::AbsOp) 

Computes absolute value of a complex number

Syntax:

operation ::= `complex.abs` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The abs op takes a single complex number and computes its absolute value.

Example:

%a = complex.abs %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultfloating-point

complex.add (complex::AddOp) 

Complex addition

Syntax:

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

The add operation takes two complex numbers and returns their sum.

Example:

%a = complex.add %b, %c : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
lhscomplex type with floating-point elements
rhscomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.angle (complex::AngleOp) 

Computes argument value of a complex number

Syntax:

operation ::= `complex.angle` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The angle op takes a single complex number and computes its argument value with a branch cut along the negative real axis.

Example:

     %a = complex.angle %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultfloating-point

complex.atan2 (complex::Atan2Op) 

Complex 2-argument arctangent

Syntax:

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

For complex numbers it is expressed using complex logarithm atan2(y, x) = -i * log((x + i * y) / sqrt(x2 + y2))

Example:

%a = complex.atan2 %b, %c : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
lhscomplex type with floating-point elements
rhscomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.bitcast (complex::BitcastOp) 

Computes bitcast between complex and equal arith types

Syntax:

operation ::= `complex.bitcast` $operand attr-dict `:` type($operand) `to` type($result)

Example:

     %a = complex.bitcast %b : complex<f32> -> i64

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands: 

OperandDescription
operandany type

Results: 

ResultDescription
resultany type

complex.conj (complex::ConjOp) 

Calculate the complex conjugate

Syntax:

operation ::= `complex.conj` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The conj op takes a single complex number and computes the complex conjugate.

Example:

%a = complex.conj %b: complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.constant (complex::ConstantOp) 

Complex number constant operation

Syntax:

operation ::= `complex.constant` $value attr-dict `:` type($complex)

The complex.constant operation creates a constant complex number from an attribute containing the real and imaginary parts.

Example:

%a = complex.constant [0.1, -1.0] : complex<f64>

Traits: AlwaysSpeculatableImplTrait, ConstantLike

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), OpAsmOpInterface

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
value::mlir::ArrayAttrarray attribute

Results: 

ResultDescription
complexcomplex-type

complex.cos (complex::CosOp) 

Computes cosine of a complex number

Syntax:

operation ::= `complex.cos` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The cos op takes a single complex number and computes the cosine of it, i.e. cos(x), where x is the input value.

Example:

%a = complex.cos %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.create (complex::CreateOp) 

Complex number creation operation

Syntax:

operation ::= `complex.create` $real `,` $imaginary attr-dict `:` type($complex)

The complex.create operation creates a complex number from two floating-point operands, the real and the imaginary part.

Example:

%a = complex.create %b, %c : complex<f32>

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands: 

OperandDescription
realfloating-point
imaginaryfloating-point

Results: 

ResultDescription
complexcomplex type with floating-point elements

complex.div (complex::DivOp) 

Complex division

Syntax:

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

The div operation takes two complex numbers and returns result of their division:

%a = complex.div %b, %c : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
lhscomplex type with floating-point elements
rhscomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.eq (complex::EqualOp) 

Computes whether two complex values are equal

Syntax:

operation ::= `complex.eq` $lhs `,` $rhs  attr-dict `:` type($lhs)

The eq op takes two complex numbers and returns whether they are equal.

Example:

%a = complex.eq %b, %c : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands: 

OperandDescription
lhscomplex type with floating-point elements
rhscomplex type with floating-point elements

Results: 

ResultDescription
result1-bit signless integer

complex.exp (complex::ExpOp) 

Computes exponential of a complex number

Syntax:

operation ::= `complex.exp` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The exp op takes a single complex number and computes the exponential of it, i.e. exp(x) or e^(x), where x is the input value. e denotes Euler’s number and is approximately equal to 2.718281.

Example:

%a = complex.exp %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.expm1 (complex::Expm1Op) 

Computes exponential of a complex number minus 1

Syntax:

operation ::= `complex.expm1` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

complex.expm1(x) := complex.exp(x) - 1

Example:

%a = complex.expm1 %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.im (complex::ImOp) 

Extracts the imaginary part of a complex number

Syntax:

operation ::= `complex.im` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The im op takes a single complex number and extracts the imaginary part.

Example:

%a = complex.im %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
imaginaryfloating-point

complex.log (complex::LogOp) 

Computes natural logarithm of a complex number

Syntax:

operation ::= `complex.log` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The log op takes a single complex number and computes the natural logarithm of it, i.e. log(x) or log_e(x), where x is the input value. e denotes Euler’s number and is approximately equal to 2.718281.

Example:

%a = complex.log %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.log1p (complex::Log1pOp) 

Computes natural logarithm of a complex number

Syntax:

operation ::= `complex.log1p` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The log op takes a single complex number and computes the natural logarithm of one plus the given value, i.e. log(1 + x) or log_e(1 + x), where x is the input value. e denotes Euler’s number and is approximately equal to 2.718281.

Example:

%a = complex.log1p %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.mul (complex::MulOp) 

Complex multiplication

Syntax:

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

The mul operation takes two complex numbers and returns their product:

%a = complex.mul %b, %c : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
lhscomplex type with floating-point elements
rhscomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.neg (complex::NegOp) 

Negation operator

Syntax:

operation ::= `complex.neg` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The neg op takes a single complex number complex and returns -complex.

Example:

%a = complex.neg %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.neq (complex::NotEqualOp) 

Computes whether two complex values are not equal

Syntax:

operation ::= `complex.neq` $lhs `,` $rhs  attr-dict `:` type($lhs)

The neq op takes two complex numbers and returns whether they are not equal.

Example:

%a = complex.neq %b, %c : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands: 

OperandDescription
lhscomplex type with floating-point elements
rhscomplex type with floating-point elements

Results: 

ResultDescription
result1-bit signless integer

complex.pow (complex::PowOp) 

Complex power function

Syntax:

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

The sqrt operation takes a complex number raises it to the given complex exponent.

Example:

%a = complex.pow %b, %c : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
lhscomplex type with floating-point elements
rhscomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.re (complex::ReOp) 

Extracts the real part of a complex number

Syntax:

operation ::= `complex.re` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The re op takes a single complex number and extracts the real part.

Example:

%a = complex.re %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
realfloating-point

complex.rsqrt (complex::RsqrtOp) 

Complex reciprocal of square root

Syntax:

operation ::= `complex.rsqrt` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The rsqrt operation computes reciprocal of square root.

Example:

%a = complex.rsqrt %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.sign (complex::SignOp) 

Computes sign of a complex number

Syntax:

operation ::= `complex.sign` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The sign op takes a single complex number and computes the sign of it, i.e. y = sign(x) = x / |x| if x != 0, otherwise y = 0.

Example:

%a = complex.sign %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.sin (complex::SinOp) 

Computes sine of a complex number

Syntax:

operation ::= `complex.sin` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The sin op takes a single complex number and computes the sine of it, i.e. sin(x), where x is the input value.

Example:

%a = complex.sin %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.sqrt (complex::SqrtOp) 

Complex square root

Syntax:

operation ::= `complex.sqrt` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The sqrt operation takes a complex number and returns its square root.

Example:

%a = complex.sqrt %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.sub (complex::SubOp) 

Complex subtraction

Syntax:

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

The sub operation takes two complex numbers and returns their difference.

Example:

%a = complex.sub %b, %c : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
lhscomplex type with floating-point elements
rhscomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.tan (complex::TanOp) 

Computes tangent of a complex number

Syntax:

operation ::= `complex.tan` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The tan op takes a single complex number and computes the tangent of it, i.e. tan(x), where x is the input value.

Example:

%a = complex.tan %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

complex.tanh (complex::TanhOp) 

Complex hyperbolic tangent

Syntax:

operation ::= `complex.tanh` $complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)

The tanh operation takes a complex number and returns its hyperbolic tangent.

Example:

%a = complex.tanh %b : complex<f32>

Traits: AlwaysSpeculatableImplTrait, Elementwise, SameOperandsAndResultType

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

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
fastmath::mlir::arith::FastMathFlagsAttr
Floating point fast math flags

Enum cases:

  • none (none)
  • reassoc (reassoc)
  • nnan (nnan)
  • ninf (ninf)
  • nsz (nsz)
  • arcp (arcp)
  • contract (contract)
  • afn (afn)
  • fast (fast)

Operands: 

OperandDescription
complexcomplex type with floating-point elements

Results: 

ResultDescription
resultcomplex type with floating-point elements

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: 

SymbolValueString
AlwaysFalse0false
OEQ1oeq
OGT2ogt
OGE3oge
OLT4olt
OLE5ole
ONE6one
ORD7ord
UEQ8ueq
UGT9ugt
UGE10uge
ULT11ult
ULE12ule
UNE13une
UNO14uno
AlwaysTrue15true

CmpIPredicate 

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

Cases: 

SymbolValueString
eq0eq
ne1ne
slt2slt
sle3sle
sgt4sgt
sge5sge
ult6ult
ule7ule
ugt8ugt
uge9uge

IntegerOverflowFlags 

Integer overflow arith flags

Cases: 

SymbolValueString
none0none
nsw1nsw
nuw2nuw

RoundingMode 

Floating point rounding mode

Cases: 

SymbolValueString
to_nearest_even0to_nearest_even
downward1downward
upward2upward
toward_zero3toward_zero
to_nearest_away4to_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: 

SymbolValueString
addf0addf
addi1addi
assign2assign
maximumf3maximumf
maxs4maxs
maxu5maxu
minimumf6minimumf
mins7mins
minu8minu
mulf9mulf
muli10muli
ori11ori
andi12andi
maxnumf13maxnumf
minnumf14minnumf

FastMathFlags 

Floating point fast math flags

Cases: 

SymbolValueString
none0none
reassoc1reassoc
nnan2nnan
ninf4ninf
nsz8nsz
arcp16arcp
contract32contract
afn64afn
fast127fast