acle icon indicating copy to clipboard operation
acle copied to clipboard

[proposal] Make intrinsics are available regardless of feature macros

Open DanielKristofKiss opened this issue 2 years ago • 0 comments

Availability of an intrinsic is sometimes gated on a feature macro like: __ARM_FEATURE_RNG. these macros only turned on when the compilation unit compiled for a given architecture e.g. with march flag.

A given function may compiled for a specific target feature and the availability check is done in runtime.

__attribute__((target("rand")))
void foo(void){
// __rndr() can't be used here. 
}

Some implementation already allows such a behaviour to favour intrinsics use instead of inline assembly. Some code manually enables these feature macros just to make the above example code compile.

Proposal: Make all intrinsics always available. Keep the feature macros to keep the indication of general use of the feature.

Compilers may still validate the availability of the instruction in a given context but still the developer is responsible of the correct use.

DanielKristofKiss avatar Jun 23 '22 15:06 DanielKristofKiss