I am working on hardware support for complex floating-point numbers. I noticed that ComplexExprEmitter in Clang directly decomposes complex numbers in order to perform arithmetic operations such as add, sub. If the target has special float/double complex data types and a set of instructions to achieve the complex operations, what’s the best way of utilizing these instructions? I guess only relying on the LLVM backend to do the instruction selection is not a good idea because the complex data types are represented as a record in LLVM IR. I am thinking of implementing another ExprEmitter, say HardwareComplexExprEmitter, to convert Clang complex types into target specific complex types, and related operations into intrinsic calls. But the disadvantages are 1) vectorizer won’t be able to vectorize the transformed code without extensions and 2) it hurts the portability of code. Any suggestions? Thanks.
Shixiong (Jason) Xu