.text .attribute 4, 16 .attribute 5, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0" .file "22_matrix_multiply.sy" .globl matrix_multiply .p2align 1 .type matrix_multiply,@function matrix_multiply: addi sp, sp, -16 sd s0, 8(sp) sd s1, 0(sp) lui a0, %hi(m1) lw a1, %lo(m1)(a0) blez a1, .LBB0_8 lui a0, %hi(n2) lw a2, %lo(n2)(a0) lui a0, %hi(n1) lw a3, %lo(n1)(a0) sgtz a0, a2 sgtz a4, a3 and a0, a0, a4 beqz a0, .LBB0_8 li t4, 0 slli a0, a1, 32 srli a6, a0, 32 slli a0, a2, 32 srli t1, a0, 32 slli a0, a3, 32 srli t2, a0, 32 lui a0, %hi(a) addi t5, a0, %lo(a) lui a0, %hi(b) addi a7, a0, %lo(b) li t0, 400 lui a0, %hi(res) addi t3, a0, %lo(res) .LBB0_3: li a1, 0 mv a4, a7 .LBB0_4: mul a0, t4, t0 slli a2, a1, 2 add a0, a0, a2 add t6, a0, t3 lw a5, 0(t6) mv a0, t2 mv a2, a4 mv a3, t5 .LBB0_5: lw s0, 0(a3) lw s1, 0(a2) mulw s0, s1, s0 addw a5, a5, s0 addi a3, a3, 4 addi a0, a0, -1 addi a2, a2, 400 bnez a0, .LBB0_5 sw a5, 0(t6) addi a1, a1, 1 addi a4, a4, 4 bne a1, t1, .LBB0_4 addi t4, t4, 1 addi t5, t5, 400 bne t4, a6, .LBB0_3 .LBB0_8: ld s0, 8(sp) ld s1, 0(sp) addi sp, sp, 16 ret .Lfunc_end0: .size matrix_multiply, .Lfunc_end0-matrix_multiply .globl main .p2align 1 .type main,@function main: addi sp, sp, -64 sd ra, 56(sp) sd s0, 48(sp) sd s1, 40(sp) sd s2, 32(sp) sd s3, 24(sp) sd s4, 16(sp) sd s5, 8(sp) sd s6, 0(sp) call getint lui s2, %hi(m1) sw a0, %lo(m1)(s2) call getint lw a2, %lo(m1)(s2) mv a1, a0 lui s5, %hi(n1) sgtz a0, a2 sgtz a3, a1 and a0, a0, a3 sw a1, %lo(n1)(s5) beqz a0, .LBB1_7 li s4, 0 lui a0, %hi(a) addi s3, a0, %lo(a) j .LBB1_3 .LBB1_2: addi s4, s4, 1 addi s3, s3, 400 bge s4, a2, .LBB1_7 .LBB1_3: sext.w a0, a1 blez a0, .LBB1_2 li s0, 0 mv s1, s3 .LBB1_5: call getint lw a1, %lo(n1)(s5) sw a0, 0(s1) addi s0, s0, 1 addi s1, s1, 4 blt s0, a1, .LBB1_5 lw a2, %lo(m1)(s2) j .LBB1_2 .LBB1_7: call getint lui s2, %hi(m2) sw a0, %lo(m2)(s2) call getint lw a2, %lo(m2)(s2) mv s6, a0 lui s5, %hi(n2) sgtz a0, a2 sgtz a3, s6 and a0, a0, a3 sw s6, %lo(n2)(s5) beqz a0, .LBB1_14 li s4, 0 lui a0, %hi(b) addi s3, a0, %lo(b) j .LBB1_10 .LBB1_9: addi s4, s4, 1 addi s3, s3, 400 bge s4, a2, .LBB1_14 .LBB1_10: sext.w a0, s6 blez a0, .LBB1_9 li s0, 0 mv s1, s3 .LBB1_12: call getint lw s6, %lo(n2)(s5) sw a0, 0(s1) addi s0, s0, 1 addi s1, s1, 4 blt s0, s6, .LBB1_12 lw a2, %lo(m2)(s2) j .LBB1_9 .LBB1_14: lui a0, %hi(m1) lwu a7, %lo(m1)(a0) sext.w a6, a7 blez a6, .LBB1_28 lui a0, %hi(n1) lw a0, %lo(n1)(a0) sext.w a2, s6 sgtz a2, a2 sgtz a3, a0 and a2, a2, a3 beqz a2, .LBB1_23 li t5, 0 slli a0, a0, 32 srli t2, a0, 32 lui a0, %hi(a) addi t6, a0, %lo(a) slli a0, s6, 32 srli t3, a0, 32 lui a0, %hi(b) addi t0, a0, %lo(b) li t1, 400 lui a0, %hi(res) addi t4, a0, %lo(res) .LBB1_17: li s0, 0 mv a3, t0 .LBB1_18: mul a0, t5, t1 slli a2, s0, 2 add a0, a0, a2 add s2, a0, t4 lw s1, 0(s2) mv a5, t6 mv a0, a3 mv a2, t2 .LBB1_19: lw a1, 0(a5) lw a4, 0(a0) mulw a1, a4, a1 addw s1, s1, a1 addi a2, a2, -1 addi a0, a0, 400 addi a5, a5, 4 bnez a2, .LBB1_19 sw s1, 0(s2) addi s0, s0, 1 addi a3, a3, 4 bne s0, t3, .LBB1_18 addi t5, t5, 1 addi t6, t6, 400 bne t5, a7, .LBB1_17 blez a6, .LBB1_28 .LBB1_23: li s4, 0 lui a0, %hi(res) addi s2, a0, %lo(res) lui s5, %hi(n2) lui s3, %hi(m1) sext.w a0, s6 blez a0, .LBB1_26 .LBB1_24: li s0, 0 mv s1, s2 .LBB1_25: lw a0, 0(s1) call putint li a0, 32 call putch lw a0, %lo(n2)(s5) addi s0, s0, 1 addi s1, s1, 4 blt s0, a0, .LBB1_25 .LBB1_26: li a0, 10 call putch lw a0, %lo(m1)(s3) addi s4, s4, 1 bge s4, a0, .LBB1_28 lw s6, %lo(n2)(s5) addi s2, s2, 400 sext.w a0, s6 bgtz a0, .LBB1_24 j .LBB1_26 .LBB1_28: li a0, 0 ld ra, 56(sp) ld s0, 48(sp) ld s1, 40(sp) ld s2, 32(sp) ld s3, 24(sp) ld s4, 16(sp) ld s5, 8(sp) ld s6, 0(sp) addi sp, sp, 64 ret .Lfunc_end1: .size main, .Lfunc_end1-main .type m1,@object .section .sbss,"aw",@nobits .globl m1 .p2align 2 m1: .word 0 .size m1, 4 .type n2,@object .globl n2 .p2align 2 n2: .word 0 .size n2, 4 .type n1,@object .globl n1 .p2align 2 n1: .word 0 .size n1, 4 .type res,@object .bss .globl res .p2align 2 res: .zero 40000 .size res, 40000 .type a,@object .globl a .p2align 2 a: .zero 40000 .size a, 40000 .type b,@object .globl b .p2align 2 b: .zero 40000 .size b, 40000 .type m2,@object .section .sbss,"aw",@nobits .globl m2 .p2align 2 m2: .word 0 .size m2, 4 .type _sysy_start,@object .bss .globl _sysy_start .p2align 3 _sysy_start: .zero 16 .size _sysy_start, 16 .type _sysy_end,@object .globl _sysy_end .p2align 3 _sysy_end: .zero 16 .size _sysy_end, 16 .type _sysy_l1,@object .globl _sysy_l1 .p2align 2 _sysy_l1: .zero 4096 .size _sysy_l1, 4096 .type _sysy_l2,@object .globl _sysy_l2 .p2align 2 _sysy_l2: .zero 4096 .size _sysy_l2, 4096 .type _sysy_h,@object .globl _sysy_h .p2align 2 _sysy_h: .zero 4096 .size _sysy_h, 4096 .type _sysy_m,@object .globl _sysy_m .p2align 2 _sysy_m: .zero 4096 .size _sysy_m, 4096 .type _sysy_s,@object .globl _sysy_s .p2align 2 _sysy_s: .zero 4096 .size _sysy_s, 4096 .type _sysy_us,@object .globl _sysy_us .p2align 2 _sysy_us: .zero 4096 .size _sysy_us, 4096 .type _sysy_idx,@object .section .sbss,"aw",@nobits .globl _sysy_idx .p2align 2 _sysy_idx: .word 0 .size _sysy_idx, 4 .ident "Debian clang version 14.0.6" .section ".note.GNU-stack","",@progbits .addrsig