To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

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

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) {
%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) {
%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) {
%rv = CALL <@v_i> @intro_rec (%n)
COMMINST @uvm.thread_exit
.funcdef @intro_rec VERSION @intro_rec_v1 <@v_i> (%n) {
%isz = EQ <@i64> %n @I64_0
BRANCH2 %isz %zero %nz
%trap_rec = TRAP <@i64> KEEPALIVE(%n)
RET <@i64> %trap_rec
%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) {
%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) {
BRANCH %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
%lt_n = SLT <@i64> %i %n
BRANCH2 %lt_n %body %exit
%i2 = ADD <@i64> %i @I64_1
%s2 = ADD <@i64> %s %i
BRANCH %head
RET <@i64> %s
%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