================
@@ -8251,6 +8251,25 @@ static void HandleVectorSizeAttr(QualType &CurType, 
const ParsedAttr &Attr,
     return;
   }
 
+  // check -mgeneral-regs-only is specified
+  const TargetInfo &targetInfo = S.getASTContext().getTargetInfo();
+  llvm::Triple::ArchType arch = targetInfo.getTriple().getArch();
+  const auto HasFeature = [](const clang::TargetOptions &targetOpts,
+                             const std::string &feature) {
+    return std::find(targetOpts.Features.begin(), targetOpts.Features.end(),
+                     feature) != targetOpts.Features.end();
+  };
+  if (CurType->isSpecificBuiltinType(BuiltinType::LongDouble)) {
----------------
phoebewang wrote:

`LongDouble` is not the only problem. GCC simply disallows any vector return 
type without SSE (`sse` feature) and gives error like `SSE register return with 
SSE disabled` and give warnings to vector argument type. 
https://godbolt.org/z/fhG76nqYo
LLVM behaves differently from GCC. It can generate code for any vector types 
expect `LongDouble` with `-mgeneral-regs-only`.
I think it would be incorrect but I'm not sure if we want to make it such 
strict.
`LongDouble` cannot be supported without `x87` feature. I'd expect something 
like https://reviews.llvm.org/D98895. It would be good if you can add vector 
type check there.
And you need to add test case for this scenario.

https://github.com/llvm/llvm-project/pull/75350
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to