regtest: add a fdleak filter for write on write on linux arm64
[valgrind.git] / tests / min_power_isa.c
blobe68c967f67d8622e717a1e1b759463a19c83f0e4
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
5 /* main() */
6 int main(int argc, char **argv)
8 /* This program is passed in a minimum ISA that the underlying hardware
9 * needs to support. If the HW supports this ISA or newer, return 0
10 * for supported. Otherwise, return 1 for not supported. Return 2 for
11 * usage error.
13 * First argument is required, it must be an ISA version number.
14 * Second argument "-debug" is optional. If passed, then the defined ISA
15 * values are printed.
17 char *min_isa;
18 int isa_level = 0;
19 int debug = 0;
21 /* set the isa_level set by the Make */
23 if ((argc == 3) && (strcmp(argv[2], "-debug") == 0)) {
24 debug = 1;
26 } else if (argc != 2) {
27 fprintf(stderr, "usage: min_power_ISA <ISA> [-debug]\n" );
28 exit(2);
31 min_isa = argv[1];
33 #ifdef HAS_ISA_2_05
34 if (debug) printf("HAS_ISA_2_05 is set\n");
35 isa_level = 5;
36 #endif
38 #ifdef HAS_ISA_2_06
39 if (debug) printf("HAS_ISA_2_06 is set\n");
40 isa_level = 6;
41 #endif
43 #ifdef HAS_ISA_2_07
44 if (debug) printf("HAS_ISA_2_07 is set\n");
45 isa_level = 7;
46 #endif
48 #ifdef HAS_ISA_3_00
49 if (debug) printf("HAS_ISA_3_00 is set\n");
50 isa_level = 8;
51 #endif
53 #ifdef HAS_ISA_3_00
54 if (debug) printf("HAS_ISA_3_00 is set\n");
55 isa_level = 9;
56 #endif
58 #ifdef HAS_ISA_3_1
59 if (debug) printf("HAS_ISA_3_1 is set\n");
60 isa_level = 9;
61 #endif
63 /* return 0 for supported (success), 1 for not supported (failure) */
64 if (strcmp (min_isa, "2.05") == 0) {
65 return !(isa_level >= 5);
67 } else if (strcmp (min_isa, "2.06") == 0) {
68 return !(isa_level >= 6);
70 } else if (strcmp (min_isa, "2.07") == 0) {
71 return !(isa_level >= 7);
73 } else if (strcmp (min_isa, "3.00") == 0) {
74 return !(isa_level >= 8);
76 } else if (strcmp (min_isa, "3.1") == 0) {
77 return !(isa_level >= 9);
79 } else {
80 fprintf(stderr, "ERROR: invalid ISA version '%s'. Valid versions numbers are:\n", min_isa);
81 fprintf(stderr, " 2.05, 2.06, 2.07, 3.00, 3.1\n" );
82 exit(2);
85 return 1;