This is an archive of the discontinued LLVM Phabricator instance.

[X86] Don't inherit 32-bit calling conventions in 64-bit mode.
AbandonedPublic

Authored by craig.topper on Jan 12 2020, 11:17 PM.

Details

Reviewers
spatel
RKSimon
rnk
Summary

Mainly this stops weird thing like v3f64 vectors getting split
into 3 pieces and then using XMM0/XMM1 for the first two, then
finding the f64 in the 32-bit mode and using FP0 next. Now we'll
fail CanLowerReturn and fall back to sret lowering instead.

I had to copy a few lines for mmx since we were dependent on
those being inherited. But I'm not sure tye make sense.
Clang doesn't generate x86_mmx type as a function argument or
return value. So it probably doesn't matter in practice.

Event Timeline

craig.topper created this revision.Jan 12 2020, 11:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2020, 11:17 PM
Herald added a subscriber: hiraditya. · View Herald Transcript

Is there a bz for this?

Is there a bz for this?

No I just noticed it while looking at the strictfp tests and saw that we were using xmm registers and x87 register for returns at the same time.

rnk accepted this revision.Jan 19 2020, 10:48 AM
rnk added subscribers: dexonsmith, probinson, rjmccall.

Hm, this will be an ABI compat issue that is relatively easy to run into:

typedef double __attribute__((vector_size(3*8))) MyVec;
MyVec f() { return {}; }

->
define dso_local <3 x double> @_Z1fv()
->

xorps   %xmm0, %xmm0
fldz

This function is already sensitive to -mavx, so maybe libraries that care don't expose functions like this. I think we want the new behavior in this patch: these things should be passed indirectly by address.

We should give people who care about a stable ABI a heads-up, though: +@dexonsmith @rjmccall @probinson

Otherwise, everything looks good to me, but please get some acknowledgement.

This revision is now accepted and ready to land.Jan 19 2020, 10:48 AM

I don't think we can just break ABI for a type like <3 x double> that can currently be produced by frontends like Clang and Swift; being sensitive to -mavx doesn't mean we don't care about the ABI at all. CC'ing @scanon in case he has other thoughts.

craig.topper abandoned this revision.Feb 27 2020, 11:41 AM