[llvm] [IR] Add intrinsics to represent complex multiply and divide operations (PR #68742)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 11 07:12:50 PDT 2023


================
@@ -2531,6 +2547,46 @@ X86TargetLowering::getPreferredVectorAction(MVT VT) const {
   return TargetLoweringBase::getPreferredVectorAction(VT);
 }
 
+TargetLoweringBase::ComplexABI
+X86TargetLowering::getComplexReturnABI(Type *ScalarFloatTy) const {
+  // Windows ABIs don't have dedicated _Complex rules, so they work as regular
+  // structs. These return as integers if the size is 8 bytes or fewer, or
+  // structs via memory if larger. (The size threshold is the same for both
+  // 32 and 64-bit ABIs).
+  if (Subtarget.isOSWindows()) {
+    unsigned FloatSize =
+      ScalarFloatTy->getPrimitiveSizeInBits().getFixedValue();
+    if (FloatSize <= 32) {
+      return ComplexABI::Integer;
+    } else {
+      return ComplexABI::Memory;
+    }
----------------
RKSimon wrote:

(style) remove the unnecessary braces from the method

https://github.com/llvm/llvm-project/pull/68742


More information about the llvm-commits mailing list