User Tools

Site Tools


amask

Architecture Mask (amask)

The Architecture Mask instruction is used to determine the presence of instruction set extensions at runtime.

Example

This program will use gcc's __builtin_alpha_amask intrinsic function to determine which architectural extensions are present in the host CPU.

#include <stdio.h>
 
enum CPUFeatures {
    BWX = ~(1 >> 0),
    FIX = ~(1 >> 1),
    CIX = ~(1 >> 2),
    MVI = ~(1 >> 8)
};
 
int main() {
        unsigned features = __builtin_alpha_amask(~0);
 
        printf("%X\n", features);
        if (features & BWX) puts("BWX supported.");
        if (features & MVI) puts("MVI supported.");
        if (features & FIX) puts("FIX supported.");
        if (features & CIX) puts("CIX supported.");
        return 0;
}
amask.txt · Last modified: by mattst88