================
@@ -159,6 +159,55 @@ static bool hasIncompleteRecordByValue(mlir::Type ty) {
   return false;
 }
 
+/// Whether \p ty has the x87 80-bit format, wrapped in LongDoubleType or not.
+static bool isX87LongDouble(mlir::Type ty) {
+  auto fpTy = dyn_cast<cir::FPTypeInterface>(ty);
+  return fpTy &&
+         &fpTy.getFloatSemantics() == &llvm::APFloat::x87DoubleExtended();
+}
+
+/// Whether \p ty is, or holds by value, an x87 long double, alone or as the
+/// element of a _Complex or a vector.
+static bool holdsX87LongDouble(mlir::Type ty) {
+  if (isa<cir::FPTypeInterface>(ty))
+    return isX87LongDouble(ty);
+  if (auto complexTy = dyn_cast<cir::ComplexType>(ty))
+    return holdsX87LongDouble(complexTy.getElementType());
----------------
andykaylor wrote:

```suggestion
    return isX87LongDouble(complexTy.getElementType());
```
There's no need for the recursive call in the case of a complex type.

https://github.com/llvm/llvm-project/pull/230302
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to