1/* 2 * Copyright 2015, NICTA 3 * 4 * This software may be distributed and modified according to the terms of 5 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 6 * See "LICENSE_BSD2.txt" for details. 7 * 8 * @TAG(NICTA_BSD) 9*/ 10 11int 12g (int i) { 13 return i * 8 + (i & 15); 14} 15 16void 17f (int *p, int x) { 18 int i; 19 20 for (i = x; i < 100; i ++) { 21 p[i] = g (i); 22 } 23} 24 25unsigned int global_x; 26 27__attribute__((noinline, noclone)) int 28create_one (unsigned int identifier) { 29 global_x ++; 30 return 1; 31} 32 33__attribute__((noinline, noclone)) int 34check_one (int result) { 35 global_x ++; 36 return 1; 37} 38 39unsigned int 40create_loop (unsigned int start, unsigned int end) { 41 int f; 42 int r; 43 44 for (f = start; f < end; f += 1024) { 45 r = create_one (f); 46 if (! check_one (r)) { 47 return 21; 48 } 49 } 50 51 return end; 52} 53 54 55