This change contains the initial support of FastMath flag in complex dialect. Similar to what we did in Arith dialect, fastmath attributes in the complex dialect are directly mapped to the corresponding LLVM fastmath flags.
In this diff,
- Definition of FastMathAttr as a custom attribute in the Complex dialect that inherits from the EnumAttr class.
- Definition of ComplexFastMathInterface, which is an interface that is implemented by operations that have a complex::fastmath attribute.
- Declaration of a default-valued fastmath attribute for unary and arithmetic operations in the Complex dialect.
- Conversion code to lower arithmetic fastmath flags to LLVM fastmath flags
NOT in this diff (but planned and progressively implemented):
- Documentation of flag meanings
- Support the fastmath flag conversion to Arith dialect
- Folding/rewrite implementations that are enabled by fastmath flags (although it's the original motivation to support the flag)
RFC: https://discourse.llvm.org/t/rfc-fastmath-flags-support-in-complex-dialect/71981
I think the ComplexOpsInterface is not required.