Eli Friedman | e53a77d | 2011-05-19 21:13:08 +0000 | [diff] [blame^] | 1 | ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=X64 |
| 2 | ; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s -check-prefix=WIN64 |
Chad Rosier | f4e832b | 2011-05-18 19:59:50 +0000 | [diff] [blame] | 3 | |
| 4 | @.str = private unnamed_addr constant [5 x i8] c"%ld\0A\00" |
| 5 | @sel = external global i8* |
| 6 | @sel3 = external global i8* |
| 7 | @sel4 = external global i8* |
| 8 | @sel5 = external global i8* |
| 9 | @sel6 = external global i8* |
| 10 | @sel7 = external global i8* |
| 11 | |
Eli Friedman | e53a77d | 2011-05-19 21:13:08 +0000 | [diff] [blame^] | 12 | ; X64: @foo |
| 13 | ; X64: jmp |
| 14 | ; WIN64: @foo |
| 15 | ; WIN64: jmp |
Chad Rosier | f4e832b | 2011-05-18 19:59:50 +0000 | [diff] [blame] | 16 | define void @foo(i64 %arg) nounwind optsize ssp noredzone { |
| 17 | entry: |
| 18 | %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([5 x i8]* @.str, i64 0, i64 0), i64 %arg) nounwind optsize noredzone |
| 19 | ret void |
| 20 | } |
| 21 | |
| 22 | declare i32 @printf(i8*, ...) optsize noredzone |
| 23 | |
Eli Friedman | e53a77d | 2011-05-19 21:13:08 +0000 | [diff] [blame^] | 24 | ; X64: @bar |
| 25 | ; X64: jmp |
| 26 | ; WIN64: @bar |
| 27 | ; WIN64: jmp |
Chad Rosier | f4e832b | 2011-05-18 19:59:50 +0000 | [diff] [blame] | 28 | define void @bar(i64 %arg) nounwind optsize ssp noredzone { |
| 29 | entry: |
| 30 | tail call void @bar2(i8* getelementptr inbounds ([5 x i8]* @.str, i64 0, i64 0), i64 %arg) nounwind optsize noredzone |
| 31 | ret void |
| 32 | } |
| 33 | |
| 34 | declare void @bar2(i8*, i64) optsize noredzone |
| 35 | |
Eli Friedman | e53a77d | 2011-05-19 21:13:08 +0000 | [diff] [blame^] | 36 | ; X64: @foo2 |
| 37 | ; X64: jmp |
| 38 | ; WIN64: @foo2 |
| 39 | ; WIN64: jmp |
Chad Rosier | f4e832b | 2011-05-18 19:59:50 +0000 | [diff] [blame] | 40 | define i8* @foo2(i8* %arg) nounwind optsize ssp noredzone { |
| 41 | entry: |
| 42 | %tmp1 = load i8** @sel, align 8, !tbaa !0 |
| 43 | %call = tail call i8* (i8*, i8*, ...)* @x2(i8* %arg, i8* %tmp1) nounwind optsize noredzone |
| 44 | ret i8* %call |
| 45 | } |
| 46 | |
| 47 | declare i8* @x2(i8*, i8*, ...) optsize noredzone |
| 48 | |
Eli Friedman | e53a77d | 2011-05-19 21:13:08 +0000 | [diff] [blame^] | 49 | ; X64: @foo6 |
| 50 | ; X64: jmp |
| 51 | ; WIN64: @foo6 |
| 52 | ; WIN64: callq |
Chad Rosier | f4e832b | 2011-05-18 19:59:50 +0000 | [diff] [blame] | 53 | define i8* @foo6(i8* %arg1, i8* %arg2) nounwind optsize ssp noredzone { |
| 54 | entry: |
| 55 | %tmp2 = load i8** @sel3, align 8, !tbaa !0 |
| 56 | %tmp3 = load i8** @sel4, align 8, !tbaa !0 |
| 57 | %tmp4 = load i8** @sel5, align 8, !tbaa !0 |
| 58 | %tmp5 = load i8** @sel6, align 8, !tbaa !0 |
| 59 | %call = tail call i8* (i8*, i8*, i8*, ...)* @x3(i8* %arg1, i8* %arg2, i8* %tmp2, i8* %tmp3, i8* %tmp4, i8* %tmp5) nounwind optsize noredzone |
| 60 | ret i8* %call |
| 61 | } |
| 62 | |
| 63 | declare i8* @x3(i8*, i8*, i8*, ...) optsize noredzone |
| 64 | |
Eli Friedman | e53a77d | 2011-05-19 21:13:08 +0000 | [diff] [blame^] | 65 | ; X64: @foo7 |
| 66 | ; X64: callq |
| 67 | ; WIN64: @foo7 |
| 68 | ; WIN64: callq |
Chad Rosier | f4e832b | 2011-05-18 19:59:50 +0000 | [diff] [blame] | 69 | define i8* @foo7(i8* %arg1, i8* %arg2) nounwind optsize ssp noredzone { |
| 70 | entry: |
| 71 | %tmp2 = load i8** @sel3, align 8, !tbaa !0 |
| 72 | %tmp3 = load i8** @sel4, align 8, !tbaa !0 |
| 73 | %tmp4 = load i8** @sel5, align 8, !tbaa !0 |
| 74 | %tmp5 = load i8** @sel6, align 8, !tbaa !0 |
| 75 | %tmp6 = load i8** @sel7, align 8, !tbaa !0 |
| 76 | %call = tail call i8* (i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...)* @x7(i8* %arg1, i8* %arg2, i8* %tmp2, i8* %tmp3, i8* %tmp4, i8* %tmp5, i8* %tmp6) nounwind optsize noredzone |
| 77 | ret i8* %call |
| 78 | } |
| 79 | |
| 80 | declare i8* @x7(i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) optsize noredzone |
| 81 | |
Eli Friedman | e53a77d | 2011-05-19 21:13:08 +0000 | [diff] [blame^] | 82 | ; X64: @foo8 |
| 83 | ; X64: callq |
| 84 | ; WIN64: @foo8 |
| 85 | ; WIN64: callq |
Chad Rosier | f4e832b | 2011-05-18 19:59:50 +0000 | [diff] [blame] | 86 | define i8* @foo8(i8* %arg1, i8* %arg2) nounwind optsize ssp noredzone { |
| 87 | entry: |
| 88 | %tmp2 = load i8** @sel3, align 8, !tbaa !0 |
| 89 | %tmp3 = load i8** @sel4, align 8, !tbaa !0 |
| 90 | %tmp4 = load i8** @sel5, align 8, !tbaa !0 |
| 91 | %tmp5 = load i8** @sel6, align 8, !tbaa !0 |
| 92 | %call = tail call i8* (i8*, i8*, i8*, ...)* @x3(i8* %arg1, i8* %arg2, i8* %tmp2, i8* %tmp3, i8* %tmp4, i8* %tmp5, i32 48879, i32 48879) nounwind optsize noredzone |
| 93 | ret i8* %call |
| 94 | } |
| 95 | |
| 96 | !0 = metadata !{metadata !"any pointer", metadata !1} |
| 97 | !1 = metadata !{metadata !"omnipotent char", metadata !2} |
| 98 | !2 = metadata !{metadata !"Simple C/C++ TBAA", null} |