Lower compound assignment for the missing type llvm::Type::FP128TyID.
authorJiangning Liu <jiangning.liu@arm.com>
Tue, 21 Oct 2014 01:34:34 +0000 (01:34 +0000)
committerJiangning Liu <jiangning.liu@arm.com>
Tue, 21 Oct 2014 01:34:34 +0000 (01:34 +0000)
llvm-svn: 220257

clang/lib/CodeGen/CGExprComplex.cpp
clang/test/CodeGen/fp128_complex.c [new file with mode: 0644]

index e957256ab5d714e7eca5c8d0c618d36f337cb1f7..ca19c94be086857257b3d7807350245f4714f3a3 100644 (file)
@@ -607,6 +607,8 @@ static StringRef getComplexMultiplyLibCallName(llvm::Type *Ty) {
     return "__multc3";
   case llvm::Type::X86_FP80TyID:
     return "__mulxc3";
+  case llvm::Type::FP128TyID:
+    return "__multc3";
   }
 }
 
@@ -746,6 +748,8 @@ ComplexPairTy ComplexExprEmitter::EmitBinDiv(const BinOpInfo &Op) {
         return EmitComplexBinOpLibCall("__divtc3", LibCallOp);
       case llvm::Type::X86_FP80TyID:
         return EmitComplexBinOpLibCall("__divxc3", LibCallOp);
+      case llvm::Type::FP128TyID:
+        return EmitComplexBinOpLibCall("__divtc3", LibCallOp);
       }
     }
     assert(LHSi && "Can have at most one non-complex operand!");
diff --git a/clang/test/CodeGen/fp128_complex.c b/clang/test/CodeGen/fp128_complex.c
new file mode 100644 (file)
index 0000000..7653bf0
--- /dev/null
@@ -0,0 +1,10 @@
+// RUN: %clang -target aarch64-linux-gnuabi %s -O3 -S -emit-llvm -o - | FileCheck %s
+#include <complex.h>
+
+complex long double a, b, c, d;
+void test_fp128_compound_assign(void) {
+  // CHECK: tail call { fp128, fp128 } @__multc3
+  a *= b;
+  // CHECK: tail call { fp128, fp128 } @__divtc3
+  c /= d;
+}