1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
.data #Début du segement de donnée
# On choisit le 0 comme comme marqueur de fin de tableau
t1:
.quad 1,3,4,0
t2:
.quad 2,3,5,0
fusion:
.rept 6
.quad 0
.endr
.text #début du segment de code
.globl _start
_start:
movq $0, %r8 # index de T1
movq $0, %r9 # index de T2
movq $0, %r10 # index de fusion
movq $t1, %r11 # adresse de T1
movq $t2, %r12 # adresse de T2
movq $fusion, %r13 #adresse de fusion
tant_que:
movq (%r11, %r8, 8) , %rbx # adresse de T1[i]
movq (%r12, %r9, 8), %rcx # adresse de T2[i]
movq (%r13, %r10, 8), %r14 # adresse de fusion[i]
movq $0 , %rax
cmp %rbx ,%rax
je finT1
cmp %rcx, %rax
je finT2
cmp %rbx, %rcx
jle ajouteC
jmp ajouteB
ajouteB:
movq %rbx, %r14
incq %r8
incq %r10
cmpq %rax, %rcx
je finT2
jmp tant_que
ajouteC:
movq %rbx, %r14
incq %r9
incq %r10
cmpq %rax, %rbx
je finT1
jmp tant_que
finT1:
movq (%r12, %r9, 8), %rcx
cmpq %rax, %rcx
je fin
jmp ajouteC
finT2:
movq (%r12, %r9, 8), %rbx
cmpq %rax, %rbx
je fin
jmp ajouteB
fin:
movq $0,%rbx
movq $1,%rax
int $0x80 |
Partager