Advertisement
Guest User

FP opt

a guest
Aug 19th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
LLVM 3.86 KB | None | 0 0
  1. ; ModuleID = 'fp.c'
  2. source_filename = "fp.c"
  3. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  4. target triple = "x86_64-unknown-linux-gnu"
  5.  
  6. @.str = private unnamed_addr constant [10 x i8] c"noopt %f\0A\00", align 1
  7. @.str1 = private unnamed_addr constant [10 x i8] c"fpoeq %f\0A\00", align 1
  8. @.str2 = private unnamed_addr constant [10 x i8] c"fpueq %f\0A\00", align 1
  9.  
  10. ; Function Attrs: nounwind uwtable
  11. define dso_local void @x(float %x, float %y, float %z) local_unnamed_addr #0 {
  12. entry:
  13.   %A = fcmp oeq float %x, -0.0
  14.   %B = fadd float %x, %z
  15.   %conv = select i1 %A, float %z, float %y
  16.   %conv2 = fpext float %conv to double
  17.   %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %conv2)
  18.   ret void
  19. }
  20.  
  21. define dso_local void @x_opt(float %x, float %y, float %z) local_unnamed_addr #0 {
  22. entry:
  23.   %A = fcmp oeq float %x, -0.0
  24.   %conv = select i1 %A, float %z, float %y
  25.   %conv2 = fpext float %conv to double
  26.   %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str1, i64 0, i64 0), double %conv2)
  27.   ret void
  28. }
  29.  
  30. define dso_local void @x_opt2(float %x, float %y, float %z) local_unnamed_addr #0 {
  31. entry:
  32.   %A = fcmp ueq float %x, -0.0
  33.   %conv = select i1 %A, float %z, float %y
  34.   %conv2 = fpext float %conv to double
  35.   %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str2, i64 0, i64 0), double %conv2)
  36.   ret void
  37. }
  38.  
  39. ; Function Attrs: nounwind
  40. declare dso_local i32 @printf(i8* nocapture readonly, ...) local_unnamed_addr #1
  41.  
  42. ; Function Attrs: nounwind uwtable
  43. define dso_local i32 @main(i32 %argc, i8** nocapture readnone %argv) local_unnamed_addr #0 {
  44. entry:
  45.   %a = add nsw i32 %argc, -1
  46.   %fl = sitofp i32 %a to float
  47.   tail call void @x(float %fl, float %fl, float %fl)
  48.   tail call void @x_opt(float %fl, float %fl, float %fl)
  49.   tail call void @x_opt2(float %fl, float %fl, float %fl)
  50.  
  51.   tail call void @x(float 0x7FF8000000000000, float %fl, float %fl)
  52.   tail call void @x_opt(float 0x7FF8000000000000, float %fl, float %fl)
  53.   tail call void @x_opt2(float 0x7FF8000000000000, float %fl, float %fl)
  54.  
  55.   tail call void @x(float 0x7FF8000000000000, float 0x7FF8000000000000, float %fl)
  56.   tail call void @x_opt(float 0x7FF8000000000000, float 0x7FF8000000000000, float %fl)
  57.   tail call void @x_opt2(float 0x7FF8000000000000, float 0x7FF8000000000000, float %fl)
  58.  
  59.   tail call void @x(float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000)
  60.   tail call void @x_opt(float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000)
  61.   tail call void @x_opt2(float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000)
  62.   ret i32 0
  63. }
  64.  
  65. ; Function Attrs: nounwind
  66. declare dso_local i32 @rand() local_unnamed_addr #1
  67.  
  68. attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
  69. attributes #1 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
  70. attributes #2 = { nounwind }
  71.  
  72. !llvm.module.flags = !{!0}
  73. !llvm.ident = !{!1}
  74.  
  75. !0 = !{i32 1, !"wchar_size", i32 4}
  76. !1 = !{!"clang version 8.0.0 (trunk 338274)"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement