GitLab will be upgraded on June 2nd 2020 at 2.00 pm (AEDT) to 3.00 pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to local Gitlab admin team.

factorial.uir 862 Bytes
Newer Older
1 2 3 4 5 6 7 8
.typedef @int_64 = int<64>
.typedef @int_1 = int<1>
.typedef @float = float
.typedef @double = double
.typedef @void = void
.typedef @int_8 = int<8>
.typedef @int_32 = int<32>
.const @int_64_1 <@int_64> = 1
9 10
.funcsig @fac_sig = (@int_64) -> (@int_64)
.funcdef @fac VERSION @fac_v1 <@fac_sig>
11
{
12
%blk_0(<@int_64> %n_3):
13
    %v48 = EQ <@int_64> %n_3 @int_64_1
14
    BRANCH2 %v48 %blk_2(@int_64_1) %blk_1(%n_3)
15

16 17
%blk_2(<@int_64> %v53):
    RET %v53
18

19
%blk_1(<@int_64> %n_3):
20 21 22
    %v50 = SUB <@int_64> %n_3 @int_64_1
    %v51 = CALL <@fac_sig> @fac (%v50)
    %v52 = MUL <@int_64> %n_3 %v51
23
    BRANCH %blk_2(%v52)
24

25
}
26

27
.const @int_64_10 <@int_32> = 10
28

29 30 31
.funcsig @main_sig = () -> ()
.funcdef @main VERSION @main_v1 <@main_sig> {
    %entry():
32
        %rv = CALL <@fac_sig> @fac (@int_64_10)
33
        [%main_trap] TRAP <> KEEPALIVE (%rv)
34 35
        COMMINST @uvm.thread_exit
}