GitLab will continue to be upgraded from 11.4.5-ce.0 on November 25th 2019 at 4.00pm (AEDT) to 5.00pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available.

Commit 7e5164ee authored by Kunshan Wang's avatar Kunshan Wang

Added missing files in OSR commit.

parent 514cf45e
// loaded after "osr-tests.uir" when doing OSR
// Calculate the sum of 0..(n-1) by n*(n-1)/2
.funcdef @sum VERSION @sum_v2 <@i_i> (%n) {
%entry:
%nm1 = SUB <@i64> %n @I64_1
%ntnm1 = MUL <@i64> %n %nm1
%rv = SDIV <@i64> %ntnm1 @I64_2
RET <@i64> %rv
}
.funcsig @sum_osr_oneshot_sig = @i64 (@i64 @i64 @i64)
// Calculate the remaining sum.
// Given s, i, n, the result is s + (n-i)*(n+i-1)/2
.funcdef @sum_osr_oneshot VERSION @sum_osr_oneshot_v1
<@sum_osr_oneshot_sig> (%s %i %n) {
%entry:
%nmi = SUB <@i64> %n %i
%npi = ADD <@i64> %n %i
%npim1 = SUB <@i64> %npi @I64_1
%nmitnpim1 = MUL <@i64> %nmi %npim1
%remsum = SDIV <@i64> %nmitnpim1 @I64_2
%rv = ADD <@i64> %s %remsum
RET <@i64> %rv
}
// requires "primitives.uir"
.funcsig @v_i = @void (@i64)
.funcdef @intro_test_base VERSION @intro_test_base_v1 <@v_i> (%n) {
%entry:
%rv = CALL <@v_i> @intro_rec (%n)
COMMINST @uvm.thread_exit
}
.funcdef @intro_rec VERSION @intro_rec_v1 <@v_i> (%n) {
%entry:
%isz = EQ <@i64> %n @I64_0
BRANCH2 %isz %zero %nz
%zero:
%trap_rec = TRAP <@i64> KEEPALIVE(%n)
RET <@i64> %trap_rec
%nz:
%nm1 = SUB <@i64> %n @I64_1
%rv = CALL <@v_i> @intro_rec (%nm1) KEEPALIVE(%n %nm1)
RET <@i64> %rv
}
.funcdef @osr_test_base VERSION @osr_test_base_v1 <@v_i> (%n) {
%entry:
%rv = CALL <@i_i> @sum (%n)
%trap_base_exit = TRAP <@void> KEEPALIVE (%rv)
COMMINST @uvm.thread_exit
}
.const @sum_v1.THRESHOLD <@i64> = 5
// Sum from 0..(n-1), but optimise when adding more than 5 numbers
.funcdef @sum VERSION @sum_v1 <@i_i> (%n) {
%entry:
BRANCH %head
%head:
%i = PHI <@i64> { %entry: @I64_0; %body: %i2; }
%s = PHI <@i64> { %entry: @I64_0; %body: %s2; }
%ge_thr = SGE <@i64> %i @sum_v1.THRESHOLD
BRANCH2 %ge_thr %opt %head2
%head2:
%lt_n = SLT <@i64> %i %n
BRANCH2 %lt_n %body %exit
%body:
%i2 = ADD <@i64> %i @I64_1
%s2 = ADD <@i64> %s %i
BRANCH %head
%exit:
RET <@i64> %s
%opt:
%trap_opt = TRAP <@void> KEEPALIVE(%n %i %s)
THROW @NULLREF // unreachable
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment