Skip to content

[Clang] Add __builtin_elementwise_fshl/fshr builtin intrinsics #152555

@RKSimon

Description

@RKSimon

Providing __builtin_elementwise_fshl / __builtin_elementwise_fshr helper builtins would allow us to represent both integer rotates and funnel/double shift patterns on scalar and vector types.

LLVM represents these as:

 fshl(X,Y,Z): (X << (Z % BW)) | (Y >> (BW - (Z % BW)))
 fshr(X,Y,Z): (X << (BW - (Z % BW))) | (Y >> (Z % BW))

X and Y have to be same type (and is the return type as well). technically Z (the shift amount) type doesn't have to match, but should be able to represent the full (modulo) shift amount range.

Metadata

Metadata

Assignees

Labels

clang:codegenIR generation bugs: mangling, exceptions, etc.clang:frontendLanguage frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions