Advertisement
Guest User

Untitled

a guest
Oct 10th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
LLVM 3.70 KB | None | 0 0
  1. $ cat add.c
  2. #include <stdint.h>
  3. uint16_t add(uint16_t a, uint16_t b) {
  4.   return a+b;
  5. }
  6. $ clang-7 -S -emit-llvm add.c -o - |opt-7 -O2 -S
  7. ; ModuleID = '<stdin>'
  8. source_filename = "add.c"
  9. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  10. target triple = "x86_64-pc-linux-gnu"
  11.  
  12. ; Function Attrs: noinline nounwind optnone uwtable
  13. define dso_local zeroext i16 @add(i16 zeroext, i16 zeroext) local_unnamed_addr #0 {
  14.   %3 = alloca i16, align 2
  15.   %4 = alloca i16, align 2
  16.   store i16 %0, i16* %3, align 2
  17.   store i16 %1, i16* %4, align 2
  18.   %5 = load i16, i16* %3, align 2
  19.   %6 = zext i16 %5 to i32
  20.   %7 = load i16, i16* %4, align 2
  21.   %8 = zext i16 %7 to i32
  22.   %9 = add nsw i32 %6, %8
  23.   %10 = trunc i32 %9 to i16
  24.   ret i16 %10
  25. }
  26.  
  27. attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "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" }
  28.  
  29. !llvm.module.flags = !{!0}
  30. !llvm.ident = !{!1}
  31.  
  32. !0 = !{i32 1, !"wchar_size", i32 4}
  33. !1 = !{!"clang version 7.0.0-5 (tags/RELEASE_700/final)"}
  34. $ clang-7 -S -emit-llvm add.c -o - |clang-7 -O2 -S -emit-llvm -o - -x ir -
  35. ; ModuleID = '<stdin>'
  36. source_filename = "add.c"
  37. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  38. target triple = "x86_64-pc-linux-gnu"
  39.  
  40. ; Function Attrs: noinline nounwind optnone uwtable
  41. define dso_local zeroext i16 @add(i16 zeroext, i16 zeroext) local_unnamed_addr #0 {
  42.   %3 = alloca i16, align 2
  43.   %4 = alloca i16, align 2
  44.   store i16 %0, i16* %3, align 2
  45.   store i16 %1, i16* %4, align 2
  46.   %5 = load i16, i16* %3, align 2
  47.   %6 = zext i16 %5 to i32
  48.   %7 = load i16, i16* %4, align 2
  49.   %8 = zext i16 %7 to i32
  50.   %9 = add nsw i32 %6, %8
  51.   %10 = trunc i32 %9 to i16
  52.   ret i16 %10
  53. }
  54.  
  55. attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "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" }
  56.  
  57. !llvm.module.flags = !{!0}
  58. !llvm.ident = !{!1}
  59.  
  60. !0 = !{i32 1, !"wchar_size", i32 4}
  61. !1 = !{!"clang version 7.0.0-5 (tags/RELEASE_700/final)"}
  62. $ clang-7 -S -emit-llvm add.c -O2 -o -
  63. ; ModuleID = 'add.c'
  64. source_filename = "add.c"
  65. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  66. target triple = "x86_64-pc-linux-gnu"
  67.  
  68. ; Function Attrs: norecurse nounwind readnone uwtable
  69. define dso_local zeroext i16 @add(i16 zeroext, i16 zeroext) local_unnamed_addr #0 {
  70.   %3 = add i16 %1, %0
  71.   ret i16 %3
  72. }
  73.  
  74. attributes #0 = { norecurse nounwind readnone 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" }
  75.  
  76. !llvm.module.flags = !{!0}
  77. !llvm.ident = !{!1}
  78.  
  79. !0 = !{i32 1, !"wchar_size", i32 4}
  80. !1 = !{!"clang version 7.0.0-5 (tags/RELEASE_700/final)"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement