Skip to content

Instantly share code, notes, and snippets.

@uenoku
Last active Dec 24, 2018
Embed
What would you like to do?
"
let rec gcd m n =
if m = 0 then n else
if m <= n then gcd m (n - m) else
gcd n (m - n) in
()
"
.text
.file "gcd.ml.ll"
.globl V14.V6.gcd # -- Begin function V14.V6.gcd
.p2align 2
.type V14.V6.gcd,@function
V14.V6.gcd: # @V14.V6.gcd
# %bb.0: # %entry
cmpdi %r3,0
beq .LBB0_3
jump .LBB0_1
.LBB0_1: # %else
# =>This Inner Loop Header: Depth=1
addi %r5, %r4, 0
sub %r4, %r4, %r3
cmpd %r5,%r3
bge .LBB0_1
jump .LBB0_2
.LBB0_2: # %else2
# in Loop: Header=BB0_1 Depth=1
sub %r4, %r3, %r5
cmpdi %r5,0
addi %r3, %r5, 0
bne .LBB0_1
jump .LBB0_3
.LBB0_3: # %ifcont3
addi %r3, %r4, 0
blr
.Lfunc_end0:
.size V14.V6.gcd, .Lfunc_end0-V14.V6.gcd
# -- End function
.globl main # -- Begin function main
.p2align 2
.type main,@function
main: # @main
# %bb.0: # %entry
li %r3, 2
store %r3, %r0, 1
blr
.Lfunc_end1:
.size main, .Lfunc_end1-main
# -- End function
.section ".note.GNU-stack","",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment