llvm / llvm/llvm-project

[CIR] Implement missing X86 builtins

Open
#167,765 111 comments 0 reactions 0 assignees View on GitHub
ClangIR good first issue
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

### 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 | - |
| roundpd, roundps, roundsd, roundss | @borysperski | #215787 |
| vfmadd, vfmaddsub | @0dminnimda | - |
| masked expand | @cs25resch11005-bhuvan | #169582 |
| masked compress | @cs25resch11005-bhuvan | #169582 |
| extractf128 | @badumbatish | #170427 |
| pmovqd512_mask | @DannyDaoBoYang | #173802 |
| pmovdb512_mask, pmovdw512_mask, pmovqw512_mask | @DannyDaoBoYang | #213571 |
| 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 |
| MSVC bit scan | - | - |
| emul, mulh | @moar55 | - |
| readwritebarrier | @Luhaocong | #171094 |
| address of return address | @Luhaocong | #171974 |
| movnti, movntsd, movntss | @lucaslive974 | #206388 |
| 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/*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.