This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] v8.3-a complex number support
ClosedPublic

Authored by samparker on Aug 16 2017, 7:10 AM.

Details

Summary

New instructions are added to AArch32 and AArch64 to aid floating-point multiplication and addition of complex numbers, where the complex numbers are packed in a vector register as a pair of elements. The Imaginary part of the number is placed in the more significant element, and the Real part of the number is placed in the less significant element.

Diff Detail

Repository
rL LLVM

Event Timeline

samparker created this revision.Aug 16 2017, 7:10 AM
SjoerdMeijer added inline comments.
lib/Target/AArch64/AArch64InstrFormats.td
9411 ↗(On Diff #111339)

I don't think we need 2 operand classes. They are essentially the same things, just some constants are different.
An example from the ARM backend is: ImmAsmOperand<int Low, int High>, where we pass the range of the imm value. I think we can do something similar here. We can then also avoid some duplication in the print and predicate functions, see also comments below.

lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
838 ↗(On Diff #111339)

We can refactor this and the next function (and create only 1), and use "PredicateMethod" in the AsmOperand class.

1550 ↗(On Diff #111339)

We can refactor this function and the next one and create one (template/parametric) function to avoid code duplication (see earlier comment about the operand classes).

lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
1335 ↗(On Diff #111339)

Same here.

samparker updated this revision to Diff 113241.Aug 30 2017, 4:50 AM

Hi Sjoerd,

I've refactored some functionality so now there is a single operand class, separate functions are still required for the asm parser to 'addXXXOperands' though.

cheers,
sam

SjoerdMeijer added inline comments.Aug 30 2017, 5:15 AM
lib/Target/AArch64/AArch64InstrFormats.td
9488 ↗(On Diff #113241)

Do you think it's worth making a base class for BaseSIMDThreeSameVectorTiedComplex and BaseSIMDThreeSameVectorComplex?

lib/Target/AArch64/AArch64InstrInfo.td
462 ↗(On Diff #113241)

Nit: F16 => FP16?

samparker updated this revision to Diff 113260.Aug 30 2017, 7:23 AM

Hi Sjoerd,

I've refactored the SIMDThreeSameVector class that is subclassed by these instructions, eliminating the need to duplicate the encodings. I've left the indexed version of the class as it is, because it is quite a bit different from the base class.

cheers,
sam

SjoerdMeijer accepted this revision.Aug 30 2017, 7:44 AM

Hi Sam, many thanks for refactoring this. Looks really good now! Just 2 nits inlined, but no need for another review.
Cheers, Sjoerd.

lib/Target/AArch64/AArch64InstrFormats.td
9426 ↗(On Diff #113260)

Nit: missing space after commas (also in the other predicates below)

lib/Target/AArch64/AArch64InstrInfo.td
462 ↗(On Diff #113260)

Nit: F16 => FP16?

This revision is now accepted and ready to land.Aug 30 2017, 7:44 AM
This revision was automatically updated to reflect the committed changes.