[PATCH] D59744: Fix i386 ABI "__m64" type bug

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 22 17:29:38 PDT 2019

rnk added subscribers: dexonsmith, rjmccall.
rnk added inline comments.

Comment at: lib/CodeGen/TargetInfo.cpp:919
 /// IsX86_MMXType - Return true if this is an MMX type.
 bool IsX86_MMXType(llvm::Type *IRType) {
-  // Return true if the type is an MMX type <2 x i32>, <4 x i16>, or <8 x i8>.
I think looking at the LLVM type to decide how something should be passed is a bad pattern to follow. We should look at the clang AST to decide how things will be passed, not LLVM types. Would that be complicated? Are there aggregate types that end up getting passed directly in MMX registers?

Comment at: lib/CodeGen/TargetInfo.cpp:9489
+      // System V i386 ABI requires __m64 value passing by MMX registers.
+      bool EnableMMX = getContext().getTargetInfo().getABI() != "no-mmx";
       return SetCGInfo(new X86_32TargetCodeGenInfo(
I think this needs to preserve existing behavior for Darwin and PS4 based on comments from @rjmccall and @dexonsmith in D60748.



More information about the cfe-commits mailing list