Changeset 375 for soft/giet_vm/giet_libs/barrier.c
- Timestamp:
- Aug 1, 2014, 12:04:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_libs/barrier.c
r368 r375 41 41 volatile unsigned int* pcount = (unsigned int *)&barrier->count; 42 42 volatile unsigned int count = 0; // avoid a warning 43 asm volatile ("barrier_llsc: \n" 44 "ll $2, 0(%1) \n" 45 "addi $3, $2, -1 \n" 46 "sc $3, 0(%1) \n" 47 "addu %0, $2, $0 \n" 48 "beqz $3, barrier_llsc \n" 43 44 asm volatile( "addu $2, %1, $0 \n" 45 "barrier_llsc: \n" 46 "ll $8, 0($2) \n" 47 "addi $9, $8, -1 \n" 48 "sc $9, 0($2) \n" 49 "beqz $9, barrier_llsc \n" 50 "addu %0, $8, $0 \n" 49 51 : "=r" (count) 50 52 : "r" (pcount) 51 : "$ 3", "$2", "memory" );53 : "$2", "$8", "$9", "memory" ); 52 54 53 55 // the last task re-initializes count and toggle sense, … … 64 66 // input: expected sense value (expected) 65 67 volatile unsigned int* psense = (unsigned int *)&barrier->sense; 66 asm volatile ( "barrier_sense: \n"67 "lw $3, 0(%0) \n"68 "bne $3, %1, barrier_sense \n"69 :70 : "r"(psense), "r"(expected)71 : "$3" );68 asm volatile ( "barrier_sense: \n" 69 "lw $3, 0(%0) \n" 70 "bne $3, %1, barrier_sense \n" 71 : 72 : "r"(psense), "r"(expected) 73 : "$3" ); 72 74 } 73 75 … … 309 311 unsigned int count = 0; // avoid a warning 310 312 311 asm volatile( "sbt_llsc: \n" 312 "ll $2, 0(%1) \n" 313 "addi $3, $2, -1 \n" 314 "sc $3, 0(%1) \n" 315 "addu %0, $2, $0 \n" 316 "beqz $3, sbt_llsc \n" 313 asm volatile( "addu $2, %1, $0 \n" 314 "sbt_llsc: \n" 315 "ll $8, 0($2) \n" 316 "addi $9, $8, -1 \n" 317 "sc $9, 0($2) \n" 318 "beqz $9, sbt_llsc \n" 319 "addu %0, $8, $0 \n" 317 320 : "=r" (count) 318 321 : "r" (pcount) 319 : "$ 3", "$2", "memory" );322 : "$2", "$8", "$9", "memory" ); 320 323 321 324 if ( count == 1 ) // last task for this level … … 336 339 // input: expected sense value (expected) 337 340 volatile unsigned int* psense = (unsigned int *)&node->sense; 338 asm volatile ( "sbt_sense: \n"339 "lw $3, 0(%0) \n"340 "bne $3, %1, sbt_sense \n"341 :342 : "r"(psense), "r"(expected)343 : "$3" );341 asm volatile ( "sbt_sense: \n" 342 "lw $3, 0(%0) \n" 343 "bne $3, %1, sbt_sense \n" 344 : 345 : "r"(psense), "r"(expected) 346 : "$3" ); 344 347 } 345 348 } // end sbt_decrement()
Note: See TracChangeset
for help on using the changeset viewer.