ssa: complex binop

This commit is contained in:
visualfc
2024-06-20 20:43:22 +08:00
parent 02a5375503
commit e4c1285eaf
3 changed files with 171 additions and 32 deletions

View File

@@ -24,45 +24,106 @@ _llgo_0:
store ptr %1, ptr @__llgo_argv, align 8
call void @"github.com/goplus/llgo/internal/runtime.init"()
call void @main.init()
%2 = alloca { float, float }, align 8
%3 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 0
store float 1.000000e+00, ptr %3, align 4
%4 = getelementptr inbounds { float, float }, ptr %2, i32 0, i32 1
store float 2.000000e+00, ptr %4, align 4
%5 = load { float, float }, ptr %2, align 4
call void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double } { double 1.000000e+00, double 2.000000e+00 })
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/internal/runtime.PrintFloat"(double 1.000000e+00)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/internal/runtime.PrintFloat"(double 2.000000e+00)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
%6 = extractvalue { float, float } %5, 0
%7 = extractvalue { float, float } %5, 1
%8 = extractvalue { float, float } %5, 0
%9 = extractvalue { float, float } %5, 1
%10 = fpext float %8 to double
%11 = fpext float %9 to double
%12 = alloca { double, double }, align 8
%13 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 0
store double %10, ptr %13, align 8
%14 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 1
store double %11, ptr %14, align 8
%15 = load { double, double }, ptr %12, align 8
call void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double } %15)
%2 = alloca { double, double }, align 8
%3 = getelementptr inbounds { double, double }, ptr %2, i32 0, i32 0
store double -1.000000e+00, ptr %3, align 8
%4 = getelementptr inbounds { double, double }, ptr %2, i32 0, i32 1
store double -2.000000e+00, ptr %4, align 8
%5 = load { double, double }, ptr %2, align 8
call void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double } %5)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
%6 = alloca { double, double }, align 8
%7 = getelementptr inbounds { double, double }, ptr %6, i32 0, i32 0
store double 4.000000e+00, ptr %7, align 8
%8 = getelementptr inbounds { double, double }, ptr %6, i32 0, i32 1
store double 6.000000e+00, ptr %8, align 8
%9 = load { double, double }, ptr %6, align 8
call void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double } %9)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
%10 = alloca { double, double }, align 8
%11 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 0
store double -2.000000e+00, ptr %11, align 8
%12 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 1
store double -2.000000e+00, ptr %12, align 8
%13 = load { double, double }, ptr %10, align 8
call void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double } %13)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
%14 = alloca { double, double }, align 8
%15 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
store double -5.000000e+00, ptr %15, align 8
%16 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
store double 1.000000e+01, ptr %16, align 8
%17 = load { double, double }, ptr %14, align 8
call void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double } %17)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
%18 = alloca { double, double }, align 8
%19 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
store double 4.400000e-01, ptr %19, align 8
%20 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
store double -8.000000e-02, ptr %20, align 8
%21 = load { double, double }, ptr %18, align 8
call void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double } %21)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
%22 = alloca { double, double }, align 8
%23 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
store double 0x7FF0000000000000, ptr %23, align 8
%24 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
store double 0x7FF0000000000000, ptr %24, align 8
%25 = load { double, double }, ptr %22, align 8
call void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double } %25)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
%26 = alloca { double, double }, align 8
%27 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 0
store double 0x7FF8000000000000, ptr %27, align 8
%28 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 1
store double 0x7FF8000000000000, ptr %28, align 8
%29 = load { double, double }, ptr %26, align 8
call void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double } %29)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 true)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
%16 = fpext float %6 to double
call void @"github.com/goplus/llgo/internal/runtime.PrintFloat"(double %16)
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 false)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 false)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
%17 = fpext float %7 to double
call void @"github.com/goplus/llgo/internal/runtime.PrintFloat"(double %17)
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 true)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
%30 = alloca { float, float }, align 8
%31 = getelementptr inbounds { float, float }, ptr %30, i32 0, i32 0
store float 1.000000e+00, ptr %31, align 4
%32 = getelementptr inbounds { float, float }, ptr %30, i32 0, i32 1
store float 2.000000e+00, ptr %32, align 4
%33 = load { float, float }, ptr %30, align 4
%34 = extractvalue { float, float } %33, 0
%35 = extractvalue { float, float } %33, 1
%36 = fpext float %34 to double
%37 = fpext float %35 to double
%38 = alloca { double, double }, align 8
%39 = getelementptr inbounds { double, double }, ptr %38, i32 0, i32 0
store double %36, ptr %39, align 8
%40 = getelementptr inbounds { double, double }, ptr %38, i32 0, i32 1
store double %37, ptr %40, align 8
%41 = load { double, double }, ptr %38, align 8
%42 = extractvalue { double, double } %41, 0
%43 = extractvalue { double, double } %41, 1
%44 = fcmp oeq double %42, 1.000000e+00
%45 = fcmp oeq double %43, 2.000000e+00
%46 = and i1 %44, %45
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %46)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
ret i32 0
}
declare void @"github.com/goplus/llgo/internal/runtime.init"()
declare void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double })
declare void @"github.com/goplus/llgo/internal/runtime.PrintFloat"(double)
declare void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8)
declare void @"github.com/goplus/llgo/internal/runtime.PrintFloat"(double)
declare void @"github.com/goplus/llgo/internal/runtime.PrintComplex"({ double, double })
declare void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1)