rnk wrote:

> I don't think this will work on its own because libcalls use LLVM's ABI.

Well, we have lots examples of custom lowered library calls, like 
X86TargetLowering::LowerI128_TO_FP (sp).

I think my hesitance was founded on a a really hazy recollection of this 2009 
commit: https://github.com/llvm/llvm-project/commit/9f34406a9048

That's where this codepath comes from, and the test case provided suggests that 
the use case is for returning large structs from `fastcc` functions. I inferred 
that this code was never intended to match any other compiler's ABI, and it 
should not be trusted. Up until that point, frontends always had to explicitly 
lower structs too large to be returned in registers with sret pointers, or the 
backend would abort, and that is still the safest way to be sure everything 
matches.

However, over the years, research shows that it has become ABI load-bearing. 
You can read the GPT research report here: 
https://gist.github.com/rnk/9a63ccc03bd3d0188d653dababbe8889

Long story short, I had a long conversation with a computer and convinced 
myself we should just use this codepath.

> It's also doesn't seem worth any effort to do a gentle migration; because of 
> the ABI mismatch, `f128` is effectively broken if you're linking with 
> `libgcc` so I'm a bit skeptical there are many people relying on this.
> 
> (+1 to relnotes anyway)

What I'm worried about going wrong is clang-cl calling compiler-rt builtins in 
libclang_rt.builtins, if there is skew between the compiler and the runtime. 
Chromium and all its derivatives ship that, but they don't have a stable ABI, 
so that probably doesn't matter.

> > Rust developers really love rediscovering all the ugly ABI lowering corner 
> > cases we've run into over the years. :p
> 
> Not sure if you're already aware or not, but Folkert and I _are_ the Rust 
> developers trying to figure out all the f128 ABI problems :) hence this PR, 
> Windows is one of the few remaining popular platforms that's currently 
> unusable.

Maybe one day 128 FP bits won't be enough, and some poor soul will come along 
and ask, "why didn't these compiler engineers think about the fp256 ABI!? so 
short-sighted!"

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

Reply via email to