|
@@ -0,0 +1,268 @@
|
|
|
+target triple = "x86_64-unknown-linux-gnu"
|
|
|
+target datalayout = ""
|
|
|
+
|
|
|
+define void @"main"()
|
|
|
+{
|
|
|
+entry:
|
|
|
+ %".2" = bitcast [8 x i8]* @"fstr" to i8*
|
|
|
+ %".3" = fmul double 0x4000000000000000, 0x4008000000000000
|
|
|
+ %".4" = fdiv double %".3", 0x4010000000000000
|
|
|
+ %".5" = fadd double 0x3ff0000000000000, %".4"
|
|
|
+ %".6" = call i64 (i8*, ...) @"printf"(i8* %".2", double %".5")
|
|
|
+ %".7" = sitofp i64 %".6" to double
|
|
|
+ %".8" = call i64 (i8*, ...) @"printf"(i8* %".2", double %".7")
|
|
|
+ %".9" = call double @"f_master"(i64 1, double 0x4024000000000000, double 0x0)
|
|
|
+ %".10" = call i64 (i8*, ...) @"printf"(i8* %".2", double %".9")
|
|
|
+ %".11" = call double @"f_master"(i64 2, double 0x3ff0000000000000, double 0x4000000000000000)
|
|
|
+ %".12" = call i64 (i8*, ...) @"printf"(i8* %".2", double %".11")
|
|
|
+ %".13" = call double @"fib_master"(i64 1, double 0x4034000000000000)
|
|
|
+ %".14" = call i64 (i8*, ...) @"printf"(i8* %".2", double %".13")
|
|
|
+ %".15" = call double @"square_master"(i64 1, double 0x4000000000000000)
|
|
|
+ %".16" = call double @"exp_master"(i64 2, double 0x4000000000000000, double %".15")
|
|
|
+ %".17" = call i64 (i8*, ...) @"printf"(i8* %".2", double %".16")
|
|
|
+ %".18" = call double @"sqrt_master"(i64 1, double 0x4000000000000000, double 0x0, double 0x0, double 0x0)
|
|
|
+ %".19" = call double @"sqrt_master"(i64 1, double 0x4000000000000000, double 0x0, double 0x0, double 0x0)
|
|
|
+ %".20" = call double @"square_master"(i64 1, double %".19")
|
|
|
+ %".21" = call i64 (i8*, ...) @"printf"(i8* %".2", double %".18", double %".20")
|
|
|
+ ret void
|
|
|
+}
|
|
|
+
|
|
|
+declare i64 @"printf"(i8* %".1", ...)
|
|
|
+
|
|
|
+@"fstr" = internal constant [8 x i8] c"> %.8f\0a\00"
|
|
|
+@"cond_global_fmt" = internal constant [12 x i8] c"> cond: %d\0a\00"
|
|
|
+define double @"f_master"(i64 %".1", double %".2", double %".3")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ switch i64 %".1", label %"switch_default" [i64 1, label %"f_arg_1" i64 2, label %"f_arg_2"]
|
|
|
+exit:
|
|
|
+ ret double 0xbff0000000000000
|
|
|
+switch_default:
|
|
|
+ br label %"exit"
|
|
|
+f_arg_1:
|
|
|
+ %".8" = bitcast [12 x i8]* @"cond_global_fmt" to i8*
|
|
|
+ %"cmp_0" = fcmp ueq double %".2", 0x0
|
|
|
+ %".9" = and i1 1, %"cmp_0"
|
|
|
+ br i1 %".9", label %"f_arg_1.if", label %"f_arg_1.endif"
|
|
|
+f_arg_1.if:
|
|
|
+ %".11" = call double @"f[CONST 0]"(double 0x0)
|
|
|
+ ret double %".11"
|
|
|
+f_arg_1.endif:
|
|
|
+ br i1 1, label %"f_arg_1.endif.if", label %"f_arg_1.endif.endif"
|
|
|
+f_arg_1.endif.if:
|
|
|
+ %".14" = call double @"f[VAR x]"(double %".2")
|
|
|
+ ret double %".14"
|
|
|
+f_arg_1.endif.endif:
|
|
|
+ br label %"exit"
|
|
|
+f_arg_2:
|
|
|
+ %".17" = bitcast [12 x i8]* @"cond_global_fmt" to i8*
|
|
|
+ br i1 1, label %"f_arg_2.if", label %"f_arg_2.endif"
|
|
|
+f_arg_2.if:
|
|
|
+ %".19" = call double @"f[VAR x, VAR y]"(double %".2", double %".3")
|
|
|
+ ret double %".19"
|
|
|
+f_arg_2.endif:
|
|
|
+ br label %"exit"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"fib_master"(i64 %".1", double %".2")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ switch i64 %".1", label %"switch_default" [i64 1, label %"fib_arg_1"]
|
|
|
+exit:
|
|
|
+ ret double 0xbff0000000000000
|
|
|
+switch_default:
|
|
|
+ br label %"exit"
|
|
|
+fib_arg_1:
|
|
|
+ %".7" = bitcast [12 x i8]* @"cond_global_fmt" to i8*
|
|
|
+ %"cmp_1" = fcmp ueq double %".2", 0x3ff0000000000000
|
|
|
+ %".8" = and i1 1, %"cmp_1"
|
|
|
+ br i1 %".8", label %"fib_arg_1.if", label %"fib_arg_1.endif"
|
|
|
+fib_arg_1.if:
|
|
|
+ %".10" = call double @"fib[CONST 1]"(double 0x3ff0000000000000)
|
|
|
+ ret double %".10"
|
|
|
+fib_arg_1.endif:
|
|
|
+ %"cmp_2" = fcmp ueq double %".2", 0x4000000000000000
|
|
|
+ %".12" = and i1 1, %"cmp_2"
|
|
|
+ br i1 %".12", label %"fib_arg_1.endif.if", label %"fib_arg_1.endif.endif"
|
|
|
+fib_arg_1.endif.if:
|
|
|
+ %".14" = call double @"fib[CONST 2]"(double 0x4000000000000000)
|
|
|
+ ret double %".14"
|
|
|
+fib_arg_1.endif.endif:
|
|
|
+ br i1 1, label %"fib_arg_1.endif.endif.if", label %"fib_arg_1.endif.endif.endif"
|
|
|
+fib_arg_1.endif.endif.if:
|
|
|
+ %".17" = call double @"fib[VAR x]"(double %".2")
|
|
|
+ ret double %".17"
|
|
|
+fib_arg_1.endif.endif.endif:
|
|
|
+ br label %"exit"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"exp_master"(i64 %".1", double %".2", double %".3")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ switch i64 %".1", label %"switch_default" [i64 2, label %"exp_arg_2"]
|
|
|
+exit:
|
|
|
+ ret double 0xbff0000000000000
|
|
|
+switch_default:
|
|
|
+ br label %"exit"
|
|
|
+exp_arg_2:
|
|
|
+ %".8" = bitcast [12 x i8]* @"cond_global_fmt" to i8*
|
|
|
+ %"cmp_0" = fcmp ueq double %".3", 0x0
|
|
|
+ %".9" = and i1 1, %"cmp_0"
|
|
|
+ br i1 %".9", label %"exp_arg_2.if", label %"exp_arg_2.endif"
|
|
|
+exp_arg_2.if:
|
|
|
+ %".11" = call double @"exp[VAR x, CONST 0]"(double %".2", double 0x0)
|
|
|
+ ret double %".11"
|
|
|
+exp_arg_2.endif:
|
|
|
+ br i1 1, label %"exp_arg_2.endif.if", label %"exp_arg_2.endif.endif"
|
|
|
+exp_arg_2.endif.if:
|
|
|
+ %".14" = call double @"exp[VAR x, VAR y]"(double %".2", double %".3")
|
|
|
+ ret double %".14"
|
|
|
+exp_arg_2.endif.endif:
|
|
|
+ br label %"exit"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"square_master"(i64 %".1", double %".2")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ switch i64 %".1", label %"switch_default" [i64 1, label %"square_arg_1"]
|
|
|
+exit:
|
|
|
+ ret double 0xbff0000000000000
|
|
|
+switch_default:
|
|
|
+ br label %"exit"
|
|
|
+square_arg_1:
|
|
|
+ %".7" = bitcast [12 x i8]* @"cond_global_fmt" to i8*
|
|
|
+ br i1 1, label %"square_arg_1.if", label %"square_arg_1.endif"
|
|
|
+square_arg_1.if:
|
|
|
+ %".9" = call double @"square[VAR x]"(double %".2")
|
|
|
+ ret double %".9"
|
|
|
+square_arg_1.endif:
|
|
|
+ br label %"exit"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"sqrt_master"(i64 %".1", double %".2", double %".3", double %".4", double %".5")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ switch i64 %".1", label %"switch_default" [i64 1, label %"sqrt_arg_1" i64 4, label %"sqrt_arg_4"]
|
|
|
+exit:
|
|
|
+ ret double 0xbff0000000000000
|
|
|
+switch_default:
|
|
|
+ br label %"exit"
|
|
|
+sqrt_arg_1:
|
|
|
+ %".10" = bitcast [12 x i8]* @"cond_global_fmt" to i8*
|
|
|
+ br i1 1, label %"sqrt_arg_1.if", label %"sqrt_arg_1.endif"
|
|
|
+sqrt_arg_1.if:
|
|
|
+ %".12" = call double @"sqrt[VAR x]"(double %".2")
|
|
|
+ ret double %".12"
|
|
|
+sqrt_arg_1.endif:
|
|
|
+ br label %"exit"
|
|
|
+sqrt_arg_4:
|
|
|
+ %".15" = bitcast [12 x i8]* @"cond_global_fmt" to i8*
|
|
|
+ %"cmp_0" = fcmp ueq double %".5", 0x0
|
|
|
+ %".16" = and i1 1, %"cmp_0"
|
|
|
+ br i1 %".16", label %"sqrt_arg_4.if", label %"sqrt_arg_4.endif"
|
|
|
+sqrt_arg_4.if:
|
|
|
+ %".18" = call double @"sqrt[VAR x, VAR s, VAR y, CONST 0]"(double %".2", double %".3", double %".4", double 0x0)
|
|
|
+ ret double %".18"
|
|
|
+sqrt_arg_4.endif:
|
|
|
+ br i1 1, label %"sqrt_arg_4.endif.if", label %"sqrt_arg_4.endif.endif"
|
|
|
+sqrt_arg_4.endif.if:
|
|
|
+ %".21" = call double @"sqrt[VAR x, VAR s, VAR y, VAR n]"(double %".2", double %".3", double %".4", double %".5")
|
|
|
+ ret double %".21"
|
|
|
+sqrt_arg_4.endif.endif:
|
|
|
+ br label %"exit"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"f[CONST 0]"(double %".1")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ ret double 0x0
|
|
|
+}
|
|
|
+
|
|
|
+define double @"f[VAR x]"(double %".1")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ %".3" = fsub double %".1", 0x3ff0000000000000
|
|
|
+ %".4" = call double @"f_master"(i64 1, double %".3", double 0x0)
|
|
|
+ %".5" = fadd double %".1", %".4"
|
|
|
+ ret double %".5"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"f[VAR x, VAR y]"(double %".1", double %".2")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ %".4" = fadd double %".1", %".2"
|
|
|
+ ret double %".4"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"fib[CONST 1]"(double %".1")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ ret double 0x3ff0000000000000
|
|
|
+}
|
|
|
+
|
|
|
+define double @"fib[CONST 2]"(double %".1")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ ret double 0x3ff0000000000000
|
|
|
+}
|
|
|
+
|
|
|
+define double @"fib[VAR x]"(double %".1")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ %".3" = fsub double %".1", 0x3ff0000000000000
|
|
|
+ %".4" = call double @"fib_master"(i64 1, double %".3")
|
|
|
+ %".5" = fsub double %".1", 0x4000000000000000
|
|
|
+ %".6" = call double @"fib_master"(i64 1, double %".5")
|
|
|
+ %".7" = fadd double %".4", %".6"
|
|
|
+ ret double %".7"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"exp[VAR x, CONST 0]"(double %".1", double %".2")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ ret double 0x3ff0000000000000
|
|
|
+}
|
|
|
+
|
|
|
+define double @"exp[VAR x, VAR y]"(double %".1", double %".2")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ %".4" = fsub double %".2", 0x3ff0000000000000
|
|
|
+ %".5" = call double @"exp_master"(i64 2, double %".1", double %".4")
|
|
|
+ %".6" = fmul double %".5", %".1"
|
|
|
+ ret double %".6"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"square[VAR x]"(double %".1")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ %".3" = fptosi double %".1" to i64
|
|
|
+ %".4" = call double @"exp_master"(i64 %".3", double 0x4000000000000000, double 0x0)
|
|
|
+ ret double %".4"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"sqrt[VAR x]"(double %".1")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ %".3" = fdiv double %".1", 0x4000000000000000
|
|
|
+ %".4" = call double @"sqrt_master"(i64 4, double %".1", double %".3", double 0x3ff0000000000000, double 0x4024000000000000)
|
|
|
+ ret double %".4"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"sqrt[VAR x, VAR s, VAR y, CONST 0]"(double %".1", double %".2", double %".3", double %".4")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ ret double %".2"
|
|
|
+}
|
|
|
+
|
|
|
+define double @"sqrt[VAR x, VAR s, VAR y, VAR n]"(double %".1", double %".2", double %".3", double %".4")
|
|
|
+{
|
|
|
+entry:
|
|
|
+ %".6" = fadd double %".2", %".3"
|
|
|
+ %".7" = fdiv double %".6", 0x4000000000000000
|
|
|
+ %".8" = fadd double %".2", %".3"
|
|
|
+ %".9" = fdiv double %".8", 0x4000000000000000
|
|
|
+ %".10" = fdiv double %".1", %".9"
|
|
|
+ %".11" = fsub double %".4", 0x3ff0000000000000
|
|
|
+ %".12" = call double @"sqrt_master"(i64 4, double %".1", double %".7", double %".10", double %".11")
|
|
|
+ ret double %".12"
|
|
|
+}
|