forked from NUDT-compiler/nudt-compiler-cpp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.6 KiB
64 lines
1.6 KiB
declare i32 @getint()
|
|
declare float @getfloat()
|
|
declare i32 @getarray(i32* %arg.a)
|
|
declare i32 @getfarray(float* %arg.a)
|
|
declare i32 @getch()
|
|
declare void @putint(i32 %arg.x)
|
|
declare void @putfloat(float %arg.x)
|
|
declare void @putarray(i32 %arg.n, i32* %arg.a)
|
|
declare void @putfarray(i32 %arg.n, float* %arg.a)
|
|
declare void @putch(i32 %arg.x)
|
|
declare void @starttime()
|
|
declare void @stoptime()
|
|
define i32 @main() {
|
|
entry:
|
|
%t0 = alloca i32
|
|
%t1 = alloca i32
|
|
%t2 = alloca i32
|
|
%t3 = alloca i32
|
|
%t4 = alloca i32
|
|
store i32 0, i32* %t0
|
|
store i32 0, i32* %t1
|
|
store i32 0, i32* %t2
|
|
store i32 0, i32* %t3
|
|
store i32 0, i32* %t4
|
|
store i32 5, i32* %t0
|
|
store i32 5, i32* %t1
|
|
store i32 1, i32* %t2
|
|
store i32 -2, i32* %t3
|
|
%t5 = load i32, i32* %t3
|
|
%t6 = sdiv i32 %t5, 2
|
|
%t7 = load i32, i32* %t0
|
|
%t8 = load i32, i32* %t1
|
|
%t9 = sub i32 %t7, %t8
|
|
%t10 = add i32 %t6, %t9
|
|
%t11 = load i32, i32* %t2
|
|
%t12 = add i32 %t11, 3
|
|
%t13 = sub i32 0, %t12
|
|
%t14 = srem i32 %t13, 2
|
|
%t15 = sub i32 %t10, %t14
|
|
store i32 %t15, i32* %t4
|
|
%t16 = load i32, i32* %t4
|
|
call void @putint(i32 %t16)
|
|
%t18 = load i32, i32* %t3
|
|
%t19 = srem i32 %t18, 2
|
|
%t20 = add i32 %t19, 67
|
|
%t21 = load i32, i32* %t0
|
|
%t22 = load i32, i32* %t1
|
|
%t23 = sub i32 %t21, %t22
|
|
%t24 = sub i32 0, %t23
|
|
%t25 = add i32 %t20, %t24
|
|
%t26 = load i32, i32* %t2
|
|
%t27 = add i32 %t26, 2
|
|
%t28 = srem i32 %t27, 2
|
|
%t29 = sub i32 0, %t28
|
|
%t30 = sub i32 %t25, %t29
|
|
store i32 %t30, i32* %t4
|
|
%t31 = load i32, i32* %t4
|
|
%t32 = add i32 %t31, 3
|
|
store i32 %t32, i32* %t4
|
|
%t33 = load i32, i32* %t4
|
|
call void @putint(i32 %t33)
|
|
ret i32 0
|
|
}
|