llvm/llvm-project

[CIR] Implement missing X86 builtins

Open

#167,765 opened on 2025年11月12日

GitHub で見る
 (91 comments) (0 reactions) (0 assignees)C++ (10,782 forks)batch import
ClangIRgood first issue

Repository metrics

Stars
 (26,378 stars)
PR merge metrics
 (平均マージ 1d 2h) (30d で 1,000 merged PRs)

説明

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 PR link
masked rounding @BhuvanB404 -
vfmadd, vfmaddsub @0dminnimda -
masked expand @cs25resch11005-bhuvan #169582
masked compress @cs25resch11005-bhuvan #169582
extractf128 @badumbatish #170427
pmovqd512_mask @DannyDaoBoYang #173802
permdi @YGGkk #172132
alignd @YGGkk #171621
shuff32x4, shufi32x4 @raventid #172960
kshiftl, kshiftr @vishruth-thimmaiah #168591
rotate @moar55 #169566
prord @moar55 #169566, #173822
select, selectsh @Priyanshu3820 #174003
cmpb, ucmpb @Priyanshu3820 #174318
vpcomb, vpcomub @vishruth-thimmaiah #170362
ktest, kortest @GeneraluseAI #169985
kadd, kor, kand, kxnor, knot, kmov @GeneraluseAI #169774
kunpck @ahmednoursphinx #168757
sqrtps @Priyanshu3820 #169310
pmul, pmulu @GeneraluseAI #169853
pternlog @medhatiwari -
vpshl, vpshr, shiftleft, shiftright @Priyanshu3820 #179538, #176653
reduce fmul, fadd, fmax, fmin @badumbatish #171633
rdrand_step @fileho #175439
fpclass @jacquesguan #172813
intersect @vishruth-thimmaiah #172554
multishift @cs25mtech12008 #169618 (stall?)
convert half @Priyanshu3820 #173143, #173572
cpuid @rturrado #173197
emul, mulh @moar55 -
readwritebarrier @Luhaocong #171094
address of return address @Luhaocong #171974
stosb @GeneraluseAI -
t2rpntlvw @ak1932 -
ud2, int2c @toprakmurat -
readfs, readgs @medhatiwari -
encodekey @moar55 #179308
aesenc, aesencwide @Luhaocong #175892

Existing incubator tests

clang/test/CIR/CodeGen/X86/*

コントリビューターガイド