Hi,
Attached patch is to fix compound assignment of fp128 complex data type.
The fix is very simple, and it only adds lowering of compound assignment
for the missing type llvm::Type::FP128TyID.
Thanks,
-Jiangning
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp
index 271c9bc..b180d34
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/lib/CodeGen/CGExprComplex.cpp
@@ -617,6 +617,8 @@ ComplexPairTy ComplexExprEmitter::EmitBinMul(const BinOpInfo &Op) {
return EmitComplexBinOpLibCall("__muldc3", Op);
case llvm::Type::X86_FP80TyID:
return EmitComplexBinOpLibCall("__mulxc3", Op);
+ case llvm::Type::FP128TyID:
+ return EmitComplexBinOpLibCall("__multc3", Op);
}
}
assert((Op.LHS.second || Op.RHS.second) &&
@@ -676,6 +678,8 @@ ComplexPairTy ComplexExprEmitter::EmitBinDiv(const BinOpInfo &Op) {
return EmitComplexBinOpLibCall("__divdc3", 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/test/CodeGen/fp128_complex.c b/test/CodeGen/fp128_complex.c
new file mode 100644
index 0000000..7653bf0
--- /dev/null
+++ b/test/CodeGen/fp128_complex.c
@@ -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;
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits