1 #include <stdio.h> 2 test_block_size1()3__attribute__((noinline)) int test_block_size1 () 4 { 5 int result = 1; 6 __asm__ __volatile__( 7 ".set noreorder" "\n\t" 8 ".set nomacro" "\n\t" 9 "b begin1" "\n\t" 10 "nop" "\n\t" 11 "begin1:" "\n\t" 12 ".rept 56" "\n\t" 13 ".word 0" "\n\t" 14 ".endr" "\n\t" 15 "li $a0, 0" "\n\t" 16 "j end1" "\n\t" 17 "nop" "\n\t" 18 "b label1" "\n\t" 19 "nop" "\n\t" 20 "label1:" "\n\t" 21 "li $a0, 1" "\n\t" 22 "end1:" "\n\t" 23 "move %0, $a0" "\n\t" 24 ".set reorder" "\n\t" 25 ".set macro" "\n\t" 26 : /* out */ "=r" (result) 27 : /* in */ 28 : /* trash */ "a0"); 29 return result; 30 } 31 test_block_size2()32__attribute__((noinline)) int test_block_size2 () 33 { 34 int result = 1; 35 __asm__ __volatile__( 36 ".set noreorder" "\n\t" 37 ".set nomacro" "\n\t" 38 "b begin2" "\n\t" 39 "nop" "\n\t" 40 "begin2:" "\n\t" 41 ".rept 58" "\n\t" 42 ".word 0" "\n\t" 43 ".endr" "\n\t" 44 "li $a0, 1" "\n\t" 45 "j end2" "\n\t" 46 "li $a0, 0" "\n\t" 47 "end2:" "\n\t" 48 "move %0, $a0" "\n\t" 49 ".set reorder" "\n\t" 50 ".set macro" "\n\t" 51 : /* out */ "=r" (result) 52 : /* in */ 53 : /* trash */ "a0"); 54 return result; 55 } 56 main()57int main () 58 { 59 /*******************TEST1*******************/ 60 if (test_block_size1() == 0) 61 printf("test1 - PASS\n"); 62 else 63 printf("test1 - FAIL\n"); 64 65 /*******************TEST2*******************/ 66 if (test_block_size2() == 0) 67 printf("test2 - PASS\n"); 68 else 69 printf("test2 - FAIL\n"); 70 return 0; 71 } 72