|
1 |
| -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes --check-globals --include-generated-funcs --version 2 |
| 1 | +// Build two version of the bitcode library, one with a target-cpu set and one without |
2 | 2 | // RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx803 -DBITCODE -emit-llvm-bc -o %t-lib.bc %s
|
| 3 | +// RUN: %clang_cc1 -triple amdgcn-- -DBITCODE -emit-llvm-bc -o %t-lib.no-cpu.bc %s |
| 4 | + |
3 | 5 | // RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx90a -emit-llvm-bc -o %t.bc %s
|
4 | 6 | // RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx90a -emit-llvm \
|
5 | 7 | // RUN: -mlink-builtin-bitcode %t-lib.bc -o - %t.bc | FileCheck %s
|
6 | 8 |
|
| 9 | +// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx90a -emit-llvm-bc -o %t.bc %s |
| 10 | +// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx90a -emit-llvm \ |
| 11 | +// RUN: -mlink-builtin-bitcode %t-lib.no-cpu.bc -o - %t.bc | FileCheck %s |
| 12 | + |
7 | 13 | #ifdef BITCODE
|
8 |
| -int foo(void) { return 42; } |
| 14 | +int no_attr(void) { return 42; } |
| 15 | +int __attribute__((target("gfx8-insts"))) attr_in_target(void) { return 42; } |
| 16 | +int __attribute__((target("extended-image-insts"))) attr_not_in_target(void) { return 42; } |
| 17 | +int __attribute__((target("no-gfx9-insts"))) attr_incompatible(void) { return 42; } |
9 | 18 | int x = 12;
|
10 | 19 | #endif
|
11 | 20 |
|
12 |
| -extern int foo(void); |
| 21 | +extern int no_attr(void); |
| 22 | +extern int attr_in_target(void); |
| 23 | +extern int attr_not_in_target(void); |
| 24 | +extern int attr_incompatible(void); |
13 | 25 | extern int x;
|
14 | 26 |
|
15 |
| -int bar() { return foo() + x; } |
16 |
| -//. |
| 27 | +int bar() { return no_attr() + attr_in_target() + attr_not_in_target() + attr_incompatible() + x; } |
| 28 | + |
17 | 29 | // CHECK: @x = internal addrspace(1) global i32 12, align 4
|
18 |
| -//. |
19 |
| -// CHECK: Function Attrs: noinline nounwind optnone |
| 30 | + |
20 | 31 | // CHECK-LABEL: define dso_local i32 @bar
|
21 |
| -// CHECK-SAME: () #[[ATTR0:[0-9]+]] { |
22 |
| -// CHECK-NEXT: entry: |
23 |
| -// CHECK-NEXT: [[RETVAL:%.*]] = alloca i32, align 4, addrspace(5) |
24 |
| -// CHECK-NEXT: [[RETVAL_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL]] to ptr |
25 |
| -// CHECK-NEXT: [[CALL:%.*]] = call i32 @foo() |
26 |
| -// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr addrspacecast (ptr addrspace(1) @x to ptr), align 4 |
27 |
| -// CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[CALL]], [[TMP0]] |
28 |
| -// CHECK-NEXT: ret i32 [[ADD]] |
| 32 | +// CHECK-SAME: () #[[ATTR_BAR:[0-9]+]] { |
29 | 33 | //
|
30 |
| -// |
31 |
| -// CHECK: Function Attrs: convergent noinline nounwind optnone |
32 |
| -// CHECK-LABEL: define internal i32 @foo |
33 |
| -// CHECK-SAME: () #[[ATTR1:[0-9]+]] { |
34 |
| -// CHECK-NEXT: entry: |
35 |
| -// CHECK-NEXT: [[RETVAL:%.*]] = alloca i32, align 4, addrspace(5) |
36 |
| -// CHECK-NEXT: [[RETVAL_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL]] to ptr |
37 |
| -// CHECK-NEXT: ret i32 42 |
38 |
| -// |
39 |
| -//. |
40 |
| -// CHECK: attributes #0 = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx90a" "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-fadd-rtn-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" } |
41 |
| -// CHECK: attributes #1 = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx90a" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" } |
42 |
| -//. |
| 34 | +// CHECK-LABEL: define internal i32 @no_attr |
| 35 | +// CHECK-SAME: () #[[ATTR_COMPATIBLE:[0-9]+]] { |
| 36 | + |
| 37 | +// CHECK-LABEL: define internal i32 @attr_in_target |
| 38 | +// CHECK-SAME: () #[[ATTR_COMPATIBLE:[0-9]+]] { |
| 39 | + |
| 40 | +// CHECK-LABEL: define internal i32 @attr_not_in_target |
| 41 | +// CHECK-SAME: () #[[ATTR_EXTEND:[0-9]+]] { |
| 42 | + |
| 43 | +// CHECK-LABEL: @attr_incompatible |
| 44 | +// CHECK-SAME: () #[[ATTR_INCOMPATIBLE:[0-9]+]] { |
| 45 | + |
| 46 | +// CHECK: attributes #[[ATTR_BAR]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx90a" "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-fadd-rtn-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" } |
| 47 | +// CHECK: attributes #[[ATTR_COMPATIBLE]] = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx90a" "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-fadd-rtn-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+gws,+image-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" } |
| 48 | +// CHECK: attributes #[[ATTR_EXTEND]] = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx90a" "target-features"="+extended-image-insts,+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-fadd-rtn-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+gws,+image-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" } |
| 49 | +// CHECK: attributes #[[ATTR_INCOMPATIBLE]] = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx90a" "target-features"="-gfx9-insts,+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-fadd-rtn-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+gfx8-insts,+gfx90a-insts,+gws,+image-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" } |
0 commit comments