clangir icon indicating copy to clipboard operation
clangir copied to clipboard

[CIR][CodeGen][Builtin] Handle remaining LLVM intrinsic type descriptors (`llvm::Intrinsic::IITDescriptor`)

Open tommymcm opened this issue 4 months ago • 6 comments

Minimized test case:

#include <emmintrin.h>
int A() { __m128 h = _mm_srli_epi16(h, 0); }

Failed assertion: https://github.com/llvm/clangir/blob/aeac352c9de907fcbb7adde22bbe4a7cfa3105be/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp#L484

Flags: -fclangir -O2

tommymcm avatar Aug 14 '25 16:08 tommymcm

Hi,

I'm interested in getting involved in the clangir project and have some experience with MLIR and LLVM. Are these tasks open for anyone to pick up, and could I try assigning it to myself and start working on them as a way of getting familiar with clangir codebase?

anirudhsundar avatar Aug 19 '25 14:08 anirudhsundar

Hi @anirudhsundar! yes, issues are free for the taking. This one should be a good way to get started with the project. Let me know if you have any questions.

tommymcm avatar Aug 19 '25 15:08 tommymcm

@tommymcm Thanks for the reply. I'd like to take a stab at this issue. I'm unable to assign the issue to myself, so I'll use this comment as a way of mentioning that.

anirudhsundar avatar Aug 20 '25 17:08 anirudhsundar

Hi @tommymcm,

I added support for vector type based on the test case above and got it working, but the issue is titled "Handle remaining LLVM intrinsic type descriptors", so I'm guessing the task is to add support for all the other types.

Do you have any suggestion on where I could find test cases to reproduce the missing types? I can only see intrinsics that are architecture specific and that might show NYI for the missing architecture specific intrinsic functions.

Thanks

anirudhsundar avatar Aug 21 '25 11:08 anirudhsundar

Hi @anirudhsundar there should be a matching function in the original (OG) clang codegen under clang/lib/CodeGen that you can use as a reference. If you want to handle the obvious ones for a first PR, could you also add all of the missing case branches (so there won't be a default anymore), and add an nyi assertion for each it would make it easier to handle each one as we need it in the future.

tommymcm avatar Aug 21 '25 14:08 tommymcm

I added support for vector type based on the test case above and got it working

This is a good start, put that PR up first - like @tommymcm said, use NYIs where needed and make incremental progress! Thanks for looking at this

bcardosolopes avatar Aug 21 '25 18:08 bcardosolopes