|
| 1 | +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -o - %s | FileCheck %s |
| 2 | +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fmv -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-NOFMV |
| 3 | + |
| 4 | +int implicit_default_decl_first(void); |
| 5 | +__attribute__((target_version("default"))) int implicit_default_decl_first(void) { return 1; } |
| 6 | +int caller1(void) { return implicit_default_decl_first(); } |
| 7 | + |
| 8 | +__attribute__((target_version("default"))) int explicit_default_def_first(void) { return 2; } |
| 9 | +int explicit_default_def_first(void); |
| 10 | +int caller2(void) { return explicit_default_def_first(); } |
| 11 | + |
| 12 | +int implicit_default_def_first(void) { return 3; } |
| 13 | +__attribute__((target_version("default"))) int implicit_default_def_first(void); |
| 14 | +int caller3(void) { return implicit_default_def_first(); } |
| 15 | + |
| 16 | +__attribute__((target_version("default"))) int explicit_default_decl_first(void); |
| 17 | +int explicit_default_decl_first(void) { return 4; } |
| 18 | +int caller4(void) { return explicit_default_decl_first(); } |
| 19 | + |
| 20 | +int no_def_implicit_default_first(void); |
| 21 | +__attribute__((target_version("default"))) int no_def_implicit_default_first(void); |
| 22 | +int caller5(void) { return no_def_implicit_default_first(); } |
| 23 | + |
| 24 | +__attribute__((target_version("default"))) int no_def_explicit_default_first(void); |
| 25 | +int no_def_explicit_default_first(void); |
| 26 | +int caller6(void) { return no_def_explicit_default_first(); } |
| 27 | +//. |
| 28 | +// CHECK: @implicit_default_decl_first = weak_odr ifunc i32 (), ptr @implicit_default_decl_first.resolver |
| 29 | +// CHECK: @explicit_default_def_first = weak_odr ifunc i32 (), ptr @explicit_default_def_first.resolver |
| 30 | +// CHECK: @implicit_default_def_first = weak_odr ifunc i32 (), ptr @implicit_default_def_first.resolver |
| 31 | +// CHECK: @explicit_default_decl_first = weak_odr ifunc i32 (), ptr @explicit_default_decl_first.resolver |
| 32 | +//. |
| 33 | +// CHECK: Function Attrs: noinline nounwind optnone |
| 34 | +// CHECK-LABEL: define {{[^@]+}}@implicit_default_decl_first.default |
| 35 | +// CHECK-SAME: () #[[ATTR0:[0-9]+]] { |
| 36 | +// CHECK-NEXT: entry: |
| 37 | +// CHECK-NEXT: ret i32 1 |
| 38 | +// |
| 39 | +// |
| 40 | +// CHECK: Function Attrs: noinline nounwind optnone |
| 41 | +// CHECK-LABEL: define {{[^@]+}}@caller1 |
| 42 | +// CHECK-SAME: () #[[ATTR1:[0-9]+]] { |
| 43 | +// CHECK-NEXT: entry: |
| 44 | +// CHECK-NEXT: [[CALL:%.*]] = call i32 @implicit_default_decl_first() |
| 45 | +// CHECK-NEXT: ret i32 [[CALL]] |
| 46 | +// |
| 47 | +// |
| 48 | +// CHECK: Function Attrs: noinline nounwind optnone |
| 49 | +// CHECK-LABEL: define {{[^@]+}}@explicit_default_def_first.default |
| 50 | +// CHECK-SAME: () #[[ATTR0]] { |
| 51 | +// CHECK-NEXT: entry: |
| 52 | +// CHECK-NEXT: ret i32 2 |
| 53 | +// |
| 54 | +// |
| 55 | +// CHECK: Function Attrs: noinline nounwind optnone |
| 56 | +// CHECK-LABEL: define {{[^@]+}}@caller2 |
| 57 | +// CHECK-SAME: () #[[ATTR1]] { |
| 58 | +// CHECK-NEXT: entry: |
| 59 | +// CHECK-NEXT: [[CALL:%.*]] = call i32 @explicit_default_def_first() |
| 60 | +// CHECK-NEXT: ret i32 [[CALL]] |
| 61 | +// |
| 62 | +// |
| 63 | +// CHECK: Function Attrs: noinline nounwind optnone |
| 64 | +// CHECK-LABEL: define {{[^@]+}}@implicit_default_def_first.default |
| 65 | +// CHECK-SAME: () #[[ATTR1]] { |
| 66 | +// CHECK-NEXT: entry: |
| 67 | +// CHECK-NEXT: ret i32 3 |
| 68 | +// |
| 69 | +// |
| 70 | +// CHECK: Function Attrs: noinline nounwind optnone |
| 71 | +// CHECK-LABEL: define {{[^@]+}}@caller3 |
| 72 | +// CHECK-SAME: () #[[ATTR1]] { |
| 73 | +// CHECK-NEXT: entry: |
| 74 | +// CHECK-NEXT: [[CALL:%.*]] = call i32 @implicit_default_def_first() |
| 75 | +// CHECK-NEXT: ret i32 [[CALL]] |
| 76 | +// |
| 77 | +// |
| 78 | +// CHECK: Function Attrs: noinline nounwind optnone |
| 79 | +// CHECK-LABEL: define {{[^@]+}}@explicit_default_decl_first.default |
| 80 | +// CHECK-SAME: () #[[ATTR0]] { |
| 81 | +// CHECK-NEXT: entry: |
| 82 | +// CHECK-NEXT: ret i32 4 |
| 83 | +// |
| 84 | +// |
| 85 | +// CHECK: Function Attrs: noinline nounwind optnone |
| 86 | +// CHECK-LABEL: define {{[^@]+}}@caller4 |
| 87 | +// CHECK-SAME: () #[[ATTR1]] { |
| 88 | +// CHECK-NEXT: entry: |
| 89 | +// CHECK-NEXT: [[CALL:%.*]] = call i32 @explicit_default_decl_first() |
| 90 | +// CHECK-NEXT: ret i32 [[CALL]] |
| 91 | +// |
| 92 | +// |
| 93 | +// CHECK: declare i32 @no_def_implicit_default_first() #[[ATTR2:[0-9]+]] |
| 94 | +// |
| 95 | +// |
| 96 | +// CHECK: Function Attrs: noinline nounwind optnone |
| 97 | +// CHECK-LABEL: define {{[^@]+}}@caller5 |
| 98 | +// CHECK-SAME: () #[[ATTR1]] { |
| 99 | +// CHECK-NEXT: entry: |
| 100 | +// CHECK-NEXT: [[CALL:%.*]] = call i32 @no_def_implicit_default_first() |
| 101 | +// CHECK-NEXT: ret i32 [[CALL]] |
| 102 | +// |
| 103 | +// |
| 104 | +// CHECK: declare i32 @no_def_explicit_default_first() #[[ATTR2]] |
| 105 | +// |
| 106 | +// |
| 107 | +// CHECK: Function Attrs: noinline nounwind optnone |
| 108 | +// CHECK-LABEL: define {{[^@]+}}@caller6 |
| 109 | +// CHECK-SAME: () #[[ATTR1]] { |
| 110 | +// CHECK-NEXT: entry: |
| 111 | +// CHECK-NEXT: [[CALL:%.*]] = call i32 @no_def_explicit_default_first() |
| 112 | +// CHECK-NEXT: ret i32 [[CALL]] |
| 113 | +// |
| 114 | +// |
| 115 | +// CHECK-LABEL: define {{[^@]+}}@implicit_default_decl_first.resolver() comdat { |
| 116 | +// CHECK-NEXT: resolver_entry: |
| 117 | +// CHECK-NEXT: ret ptr @implicit_default_decl_first.default |
| 118 | +// |
| 119 | +// |
| 120 | +// CHECK-LABEL: define {{[^@]+}}@explicit_default_def_first.resolver() comdat { |
| 121 | +// CHECK-NEXT: resolver_entry: |
| 122 | +// CHECK-NEXT: ret ptr @explicit_default_def_first.default |
| 123 | +// |
| 124 | +// |
| 125 | +// CHECK-LABEL: define {{[^@]+}}@implicit_default_def_first.resolver() comdat { |
| 126 | +// CHECK-NEXT: resolver_entry: |
| 127 | +// CHECK-NEXT: ret ptr @implicit_default_def_first.default |
| 128 | +// |
| 129 | +// |
| 130 | +// CHECK-LABEL: define {{[^@]+}}@explicit_default_decl_first.resolver() comdat { |
| 131 | +// CHECK-NEXT: resolver_entry: |
| 132 | +// CHECK-NEXT: ret ptr @explicit_default_decl_first.default |
| 133 | +// |
| 134 | +// |
| 135 | +// CHECK: declare i32 @no_def_implicit_default_first.default() #[[ATTR2]] |
| 136 | +// |
| 137 | +// |
| 138 | +// CHECK: declare i32 @no_def_explicit_default_first.default() #[[ATTR2]] |
| 139 | +// |
| 140 | +// |
| 141 | +// CHECK-NOFMV: Function Attrs: noinline nounwind optnone |
| 142 | +// CHECK-NOFMV-LABEL: define {{[^@]+}}@caller1 |
| 143 | +// CHECK-NOFMV-SAME: () #[[ATTR0:[0-9]+]] { |
| 144 | +// CHECK-NOFMV-NEXT: entry: |
| 145 | +// CHECK-NOFMV-NEXT: [[CALL:%.*]] = call i32 @implicit_default_decl_first() |
| 146 | +// CHECK-NOFMV-NEXT: ret i32 [[CALL]] |
| 147 | +// |
| 148 | +// |
| 149 | +// CHECK-NOFMV: Function Attrs: noinline nounwind optnone |
| 150 | +// CHECK-NOFMV-LABEL: define {{[^@]+}}@implicit_default_decl_first |
| 151 | +// CHECK-NOFMV-SAME: () #[[ATTR1:[0-9]+]] { |
| 152 | +// CHECK-NOFMV-NEXT: entry: |
| 153 | +// CHECK-NOFMV-NEXT: ret i32 1 |
| 154 | +// |
| 155 | +// |
| 156 | +// CHECK-NOFMV: Function Attrs: noinline nounwind optnone |
| 157 | +// CHECK-NOFMV-LABEL: define {{[^@]+}}@caller2 |
| 158 | +// CHECK-NOFMV-SAME: () #[[ATTR0]] { |
| 159 | +// CHECK-NOFMV-NEXT: entry: |
| 160 | +// CHECK-NOFMV-NEXT: [[CALL:%.*]] = call i32 @explicit_default_def_first() |
| 161 | +// CHECK-NOFMV-NEXT: ret i32 [[CALL]] |
| 162 | +// |
| 163 | +// |
| 164 | +// CHECK-NOFMV: Function Attrs: noinline nounwind optnone |
| 165 | +// CHECK-NOFMV-LABEL: define {{[^@]+}}@explicit_default_def_first |
| 166 | +// CHECK-NOFMV-SAME: () #[[ATTR1]] { |
| 167 | +// CHECK-NOFMV-NEXT: entry: |
| 168 | +// CHECK-NOFMV-NEXT: ret i32 2 |
| 169 | +// |
| 170 | +// |
| 171 | +// CHECK-NOFMV: Function Attrs: noinline nounwind optnone |
| 172 | +// CHECK-NOFMV-LABEL: define {{[^@]+}}@implicit_default_def_first |
| 173 | +// CHECK-NOFMV-SAME: () #[[ATTR0]] { |
| 174 | +// CHECK-NOFMV-NEXT: entry: |
| 175 | +// CHECK-NOFMV-NEXT: ret i32 3 |
| 176 | +// |
| 177 | +// |
| 178 | +// CHECK-NOFMV: Function Attrs: noinline nounwind optnone |
| 179 | +// CHECK-NOFMV-LABEL: define {{[^@]+}}@caller3 |
| 180 | +// CHECK-NOFMV-SAME: () #[[ATTR0]] { |
| 181 | +// CHECK-NOFMV-NEXT: entry: |
| 182 | +// CHECK-NOFMV-NEXT: [[CALL:%.*]] = call i32 @implicit_default_def_first() |
| 183 | +// CHECK-NOFMV-NEXT: ret i32 [[CALL]] |
| 184 | +// |
| 185 | +// |
| 186 | +// CHECK-NOFMV: Function Attrs: noinline nounwind optnone |
| 187 | +// CHECK-NOFMV-LABEL: define {{[^@]+}}@caller4 |
| 188 | +// CHECK-NOFMV-SAME: () #[[ATTR0]] { |
| 189 | +// CHECK-NOFMV-NEXT: entry: |
| 190 | +// CHECK-NOFMV-NEXT: [[CALL:%.*]] = call i32 @explicit_default_decl_first() |
| 191 | +// CHECK-NOFMV-NEXT: ret i32 [[CALL]] |
| 192 | +// |
| 193 | +// |
| 194 | +// CHECK-NOFMV: Function Attrs: noinline nounwind optnone |
| 195 | +// CHECK-NOFMV-LABEL: define {{[^@]+}}@explicit_default_decl_first |
| 196 | +// CHECK-NOFMV-SAME: () #[[ATTR1]] { |
| 197 | +// CHECK-NOFMV-NEXT: entry: |
| 198 | +// CHECK-NOFMV-NEXT: ret i32 4 |
| 199 | +// |
| 200 | +// |
| 201 | +// CHECK-NOFMV: Function Attrs: noinline nounwind optnone |
| 202 | +// CHECK-NOFMV-LABEL: define {{[^@]+}}@caller5 |
| 203 | +// CHECK-NOFMV-SAME: () #[[ATTR0]] { |
| 204 | +// CHECK-NOFMV-NEXT: entry: |
| 205 | +// CHECK-NOFMV-NEXT: [[CALL:%.*]] = call i32 @no_def_implicit_default_first() |
| 206 | +// CHECK-NOFMV-NEXT: ret i32 [[CALL]] |
| 207 | +// |
| 208 | +// |
| 209 | +// CHECK-NOFMV: declare i32 @no_def_implicit_default_first() #[[ATTR2:[0-9]+]] |
| 210 | +// |
| 211 | +// |
| 212 | +// CHECK-NOFMV: Function Attrs: noinline nounwind optnone |
| 213 | +// CHECK-NOFMV-LABEL: define {{[^@]+}}@caller6 |
| 214 | +// CHECK-NOFMV-SAME: () #[[ATTR0]] { |
| 215 | +// CHECK-NOFMV-NEXT: entry: |
| 216 | +// CHECK-NOFMV-NEXT: [[CALL:%.*]] = call i32 @no_def_explicit_default_first() |
| 217 | +// CHECK-NOFMV-NEXT: ret i32 [[CALL]] |
| 218 | +// |
| 219 | +// |
| 220 | +// CHECK-NOFMV: declare i32 @no_def_explicit_default_first() #[[ATTR2]] |
| 221 | +//. |
0 commit comments