Skip to content

[CIR] Implement missing X86 builtins #167765

@andykaylor

Description

@andykaylor

Overview

Implement CIR handling for X86-specific builtin functions that are not yet handled in the incubator. For these builtins, the initial implementation should be done in the upstream LLVM repository and then back-ported to the incubator. The implementation should be based on the handling of the same builtins in clang\CodeGen\TargetBuiltins\X86.c.

Many people can work on this in parallel, if we can successfully coordinate the work to avoid overlap as much as possible. To that end, I am adding a partial list here of the builtins that need to be implemented. If you would like to contribute to this task, please comment saying which builtin(s) you are working on.

I will remove builtins from this list as they are upstreamed.

Please check the table below before beginning work to make sure no one else is working on the builtins you are targeting. If you have any questions, please comment here tagging @andykaylor.

Needed builtins

Builtin group Assignee
masked rounding
vfmadd, vfmaddsub @0dminnimda
masked expand @cs25resch11005-bhuvan
masked compress @cs25resch11005-bhuvan
extractf128 @badumbatish
pmovqd512_mask
permdi @YGGkk
alignd @YGGkk
shuff32x4, shufi32x4 @raventid
kshiftl, kshiftr @vishruth-thimmaiah
rotate @moar55
prord
select, selectsh @Priyanshu3820
cmpb, ucmpb @Priyanshu3820
vpcomb, vpcomub @vishruth-thimmaiah
ktest, kortest @GeneraluseAI
kadd, kor, kand, kxnor, knot, kmov @GeneraluseAI
kunpck @ahmednoursphinx
sqrtps @Priyanshu3820
pmul, pmulu @GeneraluseAI
pternlog @medhatiwari
vpshl, vpshr, shiftleft, shiftright @Priyanshu3820
reduce fmul, fadd, fmax, fmin @badumbatish
rdrand_step @fileho
fpclass @jacquesguan
intersect @vishruth-thimmaiah
multishift @cs25mtech12008
convert half @Priyanshu3820
cpuid @rturrado
emul, mulh @moar55
readwritebarrier @Luhaocong
address of return address @Luhaocong
stosb @GeneraluseAI
t2rpntlvw
ud2, int2c @toprakmurat
readfs, readgs @medhatiwari
encodekey @moar55
aesenc, aesencwide @Luhaocong

Existing incubator tests

clang/test/CIR/CodeGen/X86/*

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClangIRAnything related to the ClangIR projectgood first issuehttps://github.com/llvm/llvm-project/contribute

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions