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.
35 lines
1.2 KiB
35 lines
1.2 KiB
source_filename = "func_test.sy"
|
|
target triple = "x86_64-pc-linux-gnu"
|
|
|
|
define dso_local i32 @add(i32 %0, i32 %1) {
|
|
;a+b-1
|
|
%3 = alloca i32, align 4
|
|
%4 = alloca i32, align 4
|
|
store i32 %0, i32* %3, align 4
|
|
store i32 %1, i32* %4, align 4
|
|
;%4 = load i32, i32* %2, align 4
|
|
;%5 = load i32, i32* %3, align 4
|
|
;%6 = add nsw i32 %4, %5
|
|
;%6 = sub nsw i32 %6, 1
|
|
;ret i32 %6
|
|
%5 = add nsw i32 %0, %1;a+b
|
|
%6 = sub nsw i32 %5, 1;a+b-1
|
|
ret i32 %6
|
|
}
|
|
|
|
define dso_local i32 @main() #0 {
|
|
%1 = alloca i32, align 4
|
|
%2 = alloca i32, align 4
|
|
%3 = alloca i32, align 4
|
|
store i32 3, i32* %1, align 4;a
|
|
store i32 2, i32* %2, align 4;b
|
|
store i32 5, i32* %3, align 4;c
|
|
%4 = load i32, i32* %1, align 4;a
|
|
%5 = load i32, i32* %2, align 4;b
|
|
%6 = load i32, i32* %3, align 4;c
|
|
%7 = call i32 @add(i32 %4, i32 %5);add(a+b)
|
|
%8 = add nsw i32 %7, %6;c+add(a+b)
|
|
ret i32 %8
|
|
}
|
|
|
|
attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } |