mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 21:39:10 -04:00
Bubble sort test program.
This commit is contained in:
parent
95854c4073
commit
629d3d47b9
1 changed files with 10 additions and 7 deletions
|
@ -7,26 +7,29 @@
|
|||
.global
|
||||
|
||||
entry: ldi %r1, Array; /* p = array; */
|
||||
ldi %r6, ArrayEnd; /* lim = array+N */
|
||||
|
||||
oloop: /* do { */
|
||||
ori %r2, %r1, #0; /* q = p; */
|
||||
ldi %r2, Array; /* q = array; */
|
||||
iloop:
|
||||
subi %r3, %r2, ArrayEnd; /* while (q != array+N) { */
|
||||
sub %r3, %r2, %r6; /* while (q != lim) { */
|
||||
iszero @p0, %r3;
|
||||
@p0 ? jmpi onext;
|
||||
|
||||
ld %r3, %r2, #0; /* if (*q > *(q + 1)) { */
|
||||
ld %r4, %r2, __WORD; /* temp = *(q + 1); */
|
||||
sub %r5, %r3, %r4;
|
||||
sub %r5, %r4, %r3;
|
||||
isneg @p0, %r5;
|
||||
notp @p0, @p0;
|
||||
@p0 ? jmpi inext;
|
||||
st %r3, %r2, __WORD; /* *(q + 1) = *q; */
|
||||
st %r3, %r2, #0; /* *q = temp; */
|
||||
st %r4, %r2, #0; /* *q = temp; */
|
||||
/* } */
|
||||
inext: addi %r2, %r2, #1; /* q++; */
|
||||
inext: addi %r2, %r2, __WORD; /* q++; */
|
||||
jmpi iloop; /* } */
|
||||
onext: addi %r1, %r1, #1; /* p++; */
|
||||
subi %r3, %r1, ArrayEnd; /* } while (p != p + SIZE); */
|
||||
onext: addi %r1, %r1, __WORD; /* p++; */
|
||||
subi %r6, %r6, __WORD; /* lim--; */
|
||||
subi %r3, %r1, ArrayEnd; /* } while (p != array+N) */
|
||||
rtop @p0, %r3;
|
||||
@p0 ? jmpi oloop;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue