From db7cfd501c234089cdd256faa8b9d5126d280f51 Mon Sep 17 00:00:00 2001 From: Pierre Valarcher Date: Tue, 28 Sep 2021 11:03:21 +0200 Subject: [PATCH] assembleur --- Exemples/main.s | 153 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 146 insertions(+), 7 deletions(-) diff --git a/Exemples/main.s b/Exemples/main.s index 83dcea6..cf1223f 100644 --- a/Exemples/main.s +++ b/Exemples/main.s @@ -5,15 +5,154 @@ _main: ; @main .cfi_startproc ; %bb.0: - sub sp, sp, #16 ; =16 - .cfi_def_cfa_offset 16 - mov w8, #0 - str wzr, [sp, #12] - str w0, [sp, #8] - str x1, [sp] + sub sp, sp, #112 ; =112 + stp x29, x30, [sp, #96] ; 16-byte Folded Spill + add x29, sp, #96 ; =96 + .cfi_def_cfa w29, 16 + .cfi_offset w30, -8 + .cfi_offset w29, -16 + adrp x8, l_.str.1@PAGE + add x8, x8, l_.str.1@PAGEOFF + adrp x9, l_.str.5@PAGE + add x9, x9, l_.str.5@PAGEOFF + stur wzr, [x29, #-4] + stur w0, [x29, #-8] + stur x1, [x29, #-16] + adrp x0, l_.str@PAGE + add x0, x0, l_.str@PAGEOFF + stur x8, [x29, #-40] ; 8-byte Folded Spill + str x9, [sp, #48] ; 8-byte Folded Spill + bl _printf + ldur x8, [x29, #-40] ; 8-byte Folded Reload mov x0, x8 - add sp, sp, #16 ; =16 + mov x9, sp + sub x10, x29, #20 ; =20 + str x10, [x9] + bl _scanf + adrp x8, l_.str.2@PAGE + add x8, x8, l_.str.2@PAGEOFF + mov x0, x8 + bl _printf + ldur x8, [x29, #-40] ; 8-byte Folded Reload + mov x0, x8 + mov x9, sp + sub x10, x29, #24 ; =24 + str x10, [x9] + bl _scanf + adrp x8, l_.str.3@PAGE + add x8, x8, l_.str.3@PAGEOFF + mov x0, x8 + bl _printf + ldur x8, [x29, #-40] ; 8-byte Folded Reload + mov x0, x8 + mov x9, sp + sub x10, x29, #28 ; =28 + str x10, [x9] + bl _scanf + ldur w11, [x29, #-20] + ; implicit-def: $x1 + mov x1, x11 + ldur w11, [x29, #-24] + ; implicit-def: $x2 + mov x2, x11 + ldur w11, [x29, #-28] + ; implicit-def: $x3 + mov x3, x11 + adrp x8, l_.str.4@PAGE + add x8, x8, l_.str.4@PAGEOFF + mov x0, x8 + mov x8, sp + str x1, [x8] + str x2, [x8, #8] + str x3, [x8, #16] + bl _printf + ldur w11, [x29, #-20] + ldur w12, [x29, #-24] + cmp w11, w12 + b.lt LBB0_3 +; %bb.1: + ldur w8, [x29, #-20] + ldur w9, [x29, #-28] + cmp w8, w9 + b.lt LBB0_3 +; %bb.2: + ldur w8, [x29, #-20] + ; implicit-def: $x0 + mov x0, x8 + ldr x9, [sp, #48] ; 8-byte Folded Reload + str x0, [sp, #40] ; 8-byte Folded Spill + mov x0, x9 + mov x10, sp + ldr x11, [sp, #40] ; 8-byte Folded Reload + str x11, [x10] + bl _printf +LBB0_3: + ldur w8, [x29, #-24] + ldur w9, [x29, #-20] + cmp w8, w9 + b.lt LBB0_6 +; %bb.4: + ldur w8, [x29, #-24] + ldur w9, [x29, #-28] + cmp w8, w9 + b.lt LBB0_6 +; %bb.5: + ldur w8, [x29, #-24] + ; implicit-def: $x0 + mov x0, x8 + ldr x9, [sp, #48] ; 8-byte Folded Reload + str x0, [sp, #32] ; 8-byte Folded Spill + mov x0, x9 + mov x10, sp + ldr x11, [sp, #32] ; 8-byte Folded Reload + str x11, [x10] + bl _printf +LBB0_6: + ldur w8, [x29, #-28] + ldur w9, [x29, #-20] + cmp w8, w9 + b.lt LBB0_9 +; %bb.7: + ldur w8, [x29, #-28] + ldur w9, [x29, #-24] + cmp w8, w9 + b.lt LBB0_9 +; %bb.8: + ldur w8, [x29, #-28] + ; implicit-def: $x0 + mov x0, x8 + ldr x9, [sp, #48] ; 8-byte Folded Reload + str x0, [sp, #24] ; 8-byte Folded Spill + mov x0, x9 + mov x10, sp + ldr x11, [sp, #24] ; 8-byte Folded Reload + str x11, [x10] + bl _printf +LBB0_9: + mov w8, #0 + mov x0, x8 + ldp x29, x30, [sp, #96] ; 16-byte Folded Reload + add sp, sp, #112 ; =112 ret .cfi_endproc ; -- End function + .section __TEXT,__cstring,cstring_literals +l_.str: ; @.str + .asciz "Entrer un premier entier : " + +l_.str.1: ; @.str.1 + .asciz "%d" + +l_.str.2: ; @.str.2 + .asciz "Entrer un deuxieme entier : " + +l_.str.3: ; @.str.3 + .asciz "Entrer un troisieme entier : " + +l_.str.4: ; @.str.4 + .asciz "Entiers lus : %d, %d, %d\n" + +l_.str.5: ; @.str.5 + .asciz "Max = %d\n" + .subsections_via_symbols