[clang] [libc] [llvm] [libc] Implement (v|f)printf on the GPU (PR #96369)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 1 06:06:38 PDT 2024


jhuber6 wrote:

> The nvptx lowering looks dubious - values smaller than slot size should be passed with the same alignment as the slot and presently aren't. A struct containing i8, i16 or half should be miscompiled on nvptx as written.

I mentioned this in the original patch, it's correct as far as I know. NVPTX does not require nested structs to have slot alignment, which means that the minimum alignment is exactly the type. The C ABI helps us here by making arguments passed directly all get type promoted to `i32`. You could theoretically break this if you didn't go through the C ABI and ignored type promotion, but I'm not concerned with that kind of misuse since it's against the ABI in the first place.

https://github.com/llvm/llvm-project/pull/96369


More information about the cfe-commits mailing list