return *Float128Format;
}
- /// Return true if the 'long double' type should be mangled like
- /// __float128.
- virtual bool useFloat128ManglingForLongDouble() const { return false; }
+ /// Return the mangled code of long double.
+ virtual const char *getLongDoubleMangling() const { return "e"; }
+
+ /// Return the mangled code of __float128.
+ virtual const char *getFloat128Mangling() const { return "g"; }
/// Return the value for the C99 FLT_EVAL_METHOD macro.
virtual unsigned getFloatEvalMethod() const { return 0; }
Out << 'd';
break;
case BuiltinType::LongDouble: {
- bool UseFloat128Mangling =
- getASTContext().getTargetInfo().useFloat128ManglingForLongDouble();
- if (getASTContext().getLangOpts().OpenMP &&
- getASTContext().getLangOpts().OpenMPIsDevice) {
- UseFloat128Mangling = getASTContext()
- .getAuxTargetInfo()
- ->useFloat128ManglingForLongDouble();
- }
- Out << (UseFloat128Mangling ? 'g' : 'e');
+ const TargetInfo *TI = getASTContext().getLangOpts().OpenMP &&
+ getASTContext().getLangOpts().OpenMPIsDevice
+ ? getASTContext().getAuxTargetInfo()
+ : &getASTContext().getTargetInfo();
+ Out << TI->getLongDoubleMangling();
break;
}
case BuiltinType::Float128: {
- bool UseFloat128Mangling =
- getASTContext().getTargetInfo().useFloat128ManglingForLongDouble();
- if (getASTContext().getLangOpts().OpenMP &&
- getASTContext().getLangOpts().OpenMPIsDevice) {
- UseFloat128Mangling = getASTContext()
- .getAuxTargetInfo()
- ->useFloat128ManglingForLongDouble();
- }
- if (UseFloat128Mangling)
- Out << "U10__float128"; // Match the GCC mangling
- else
- Out << 'g';
+ const TargetInfo *TI = getASTContext().getLangOpts().OpenMP &&
+ getASTContext().getLangOpts().OpenMPIsDevice
+ ? getASTContext().getAuxTargetInfo()
+ : &getASTContext().getTargetInfo();
+ Out << TI->getFloat128Mangling();
break;
}
case BuiltinType::NullPtr:
bool hasSjLjLowering() const override { return true; }
- bool useFloat128ManglingForLongDouble() const override {
- return LongDoubleWidth == 128 &&
- LongDoubleFormat == &llvm::APFloat::PPCDoubleDouble() &&
- getTriple().isOSBinFormatELF();
+ const char *getLongDoubleMangling() const override {
+ if (LongDoubleWidth == 64)
+ return "e";
+ return LongDoubleFormat == &llvm::APFloat::PPCDoubleDouble()
+ ? "g"
+ : "u9__ieee128";
}
+ const char *getFloat128Mangling() const override { return "u9__ieee128"; }
};
class LLVM_LIBRARY_VISIBILITY PPC32TargetInfo : public PPCTargetInfo {
return "";
}
- bool useFloat128ManglingForLongDouble() const override { return true; }
+ const char *getLongDoubleMangling() const override { return "g"; }
};
} // namespace targets
} // namespace clang
LongDoubleFormat = &llvm::APFloat::IEEEquad();
}
- bool useFloat128ManglingForLongDouble() const override { return true; }
+ const char *getLongDoubleMangling() const override { return "g"; }
};
} // namespace targets
} // namespace clang
// CHECK-DAG: @_ZN12_GLOBAL__N_13f2nE = internal global fp128 0xL00000000000000004004080000000000
// CHECK-DAG: @_ZN12_GLOBAL__N_15arr1nE = internal global [10 x fp128]
// CHECK-DAG: @_ZN12_GLOBAL__N_15arr2nE = internal global [3 x fp128] [fp128 0xL33333333333333333FFF333333333333, fp128 0xL00000000000000004000800000000000, fp128 0xL00000000000000004025176592E00000]
-// CHECK-DAG: define internal fp128 @_ZN12_GLOBAL__N_16func1nERKU10__float128(fp128*
+// CHECK-DAG: define internal fp128 @_ZN12_GLOBAL__N_16func1nERKu9__ieee128(fp128*
// CHECK-DAG: @f1f = global fp128 0xL00000000000000000000000000000000
// CHECK-DAG: @f2f = global fp128 0xL33333333333333334004033333333333
// CHECK-DAG: @arr1f = global [10 x fp128]
// CHECK-DAG: @arr2f = global [3 x fp128] [fp128 0xL3333333333333333BFFF333333333333, fp128 0xL0000000000000000C000800000000000, fp128 0xL0000000000000000C025176592E00000]
-// CHECK-DAG: declare fp128 @_Z6func1fU10__float128(fp128)
-// CHECK-DAG: define linkonce_odr void @_ZN2C1C2EU10__float128(%class.C1* %this, fp128 %arg)
-// CHECK-DAG: define linkonce_odr fp128 @_ZN2C16func2cEU10__float128(fp128 %arg)
-// CHECK-DAG: define linkonce_odr fp128 @_Z6func1tIU10__float128ET_S0_(fp128 %arg)
+// CHECK-DAG: declare fp128 @_Z6func1fu9__ieee128(fp128)
+// CHECK-DAG: define linkonce_odr void @_ZN2C1C2Eu9__ieee128(%class.C1* %this, fp128 %arg)
+// CHECK-DAG: define linkonce_odr fp128 @_ZN2C16func2cEu9__ieee128(fp128 %arg)
+// CHECK-DAG: define linkonce_odr fp128 @_Z6func1tIu9__ieee128ET_S0_(fp128 %arg)
// CHECK-DAG: @__const.main.s1 = private unnamed_addr constant %struct.S1 { fp128 0xL00000000000000004006080000000000 }
// CHECK-DAG: store fp128 0xLF0AFD0EBFF292DCE42E0B38CDD83F26F, fp128* %f1l, align 16
// CHECK-DAG: store fp128 0xL00000000000000008000000000000000, fp128* %f2l, align 16