1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #include <cpu-features.h> 17 #include <stdio.h> 18 19 int main(void) 20 { 21 AndroidCpuFamily family = android_getCpuFamily(); 22 switch (family) { 23 case ANDROID_CPU_FAMILY_ARM: 24 printf("CPU family is ARM\n"); 25 break; 26 case ANDROID_CPU_FAMILY_X86: 27 printf("CPU family is x86\n"); 28 break; 29 default: 30 fprintf(stderr, "Unsupported CPU family: %d\n", family); 31 return 1; 32 } 33 34 if (family == ANDROID_CPU_FAMILY_ARM) { 35 uint64_t features = android_getCpuFeatures(); 36 printf( "Supported ARM features:\n"); 37 if ((features & ANDROID_CPU_ARM_FEATURE_ARMv7) != 0) { 38 printf( " ARMv7\n" ); 39 } 40 if ((features & ANDROID_CPU_ARM_FEATURE_VFPv3) != 0) { 41 printf( " VFPv3\n" ); 42 } 43 if ((features & ANDROID_CPU_ARM_FEATURE_NEON) != 0) { 44 printf( " NEON\n" ); 45 } 46 } 47 return 0; 48 } 49