|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --scrub-attributes --version 5 |
| 2 | +; REQUIRES: amdgpu-registered-target |
| 3 | + |
| 4 | +; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 -passes='amdgpu-expand-feature-predicates' %s -o - | FileCheck --check-prefix=GFX906 %s |
| 5 | +; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1201 -passes='amdgpu-expand-feature-predicates' %s -o - | FileCheck --check-prefix=GFX1201 %s |
| 6 | + |
| 7 | +@llvm.amdgcn.is.gfx906 = external addrspace(1) externally_initialized constant i1 |
| 8 | +@llvm.amdgcn.is.gfx1201 = external addrspace(1) externally_initialized constant i1 |
| 9 | + |
| 10 | +define external void @extern_linkage() { |
| 11 | +; GFX906-LABEL: define void @extern_linkage( |
| 12 | +; GFX906-SAME: ) #[[ATTR0:[0-9]+]] { |
| 13 | +; GFX906-NEXT: [[ENTRY:.*:]] |
| 14 | +; GFX906-NEXT: ret void |
| 15 | +; |
| 16 | +; GFX1201-LABEL: define void @extern_linkage( |
| 17 | +; GFX1201-SAME: ) #[[ATTR0:[0-9]+]] { |
| 18 | +; GFX1201-NEXT: [[ENTRY:.*:]] |
| 19 | +; GFX1201-NEXT: ret void |
| 20 | +; |
| 21 | +entry: |
| 22 | + ret void |
| 23 | +} |
| 24 | + |
| 25 | +define private void @non_predicated_uses() { |
| 26 | +; GFX906-LABEL: define private void @non_predicated_uses( |
| 27 | +; GFX906-SAME: ) #[[ATTR0]] { |
| 28 | +; GFX906-NEXT: [[ENTRY:.*:]] |
| 29 | +; GFX906-NEXT: ret void |
| 30 | +; |
| 31 | +; GFX1201-LABEL: define private void @non_predicated_uses( |
| 32 | +; GFX1201-SAME: ) #[[ATTR0]] { |
| 33 | +; GFX1201-NEXT: [[ENTRY:.*:]] |
| 34 | +; GFX1201-NEXT: ret void |
| 35 | +; |
| 36 | +entry: |
| 37 | + ret void |
| 38 | +} |
| 39 | + |
| 40 | +define internal void @remove_on_906() { |
| 41 | +; GFX1201-LABEL: define internal void @remove_on_906( |
| 42 | +; GFX1201-SAME: ) #[[ATTR0]] { |
| 43 | +; GFX1201-NEXT: [[ENTRY:.*:]] |
| 44 | +; GFX1201-NEXT: ret void |
| 45 | +; |
| 46 | +entry: |
| 47 | + ret void |
| 48 | +} |
| 49 | + |
| 50 | +define internal void @remove_on_1201() { |
| 51 | +; GFX906-LABEL: define internal void @remove_on_1201( |
| 52 | +; GFX906-SAME: ) #[[ATTR0]] { |
| 53 | +; GFX906-NEXT: [[ENTRY:.*:]] |
| 54 | +; GFX906-NEXT: ret void |
| 55 | +; |
| 56 | +entry: |
| 57 | + ret void |
| 58 | +} |
| 59 | + |
| 60 | +define void @foo() { |
| 61 | +; GFX906-LABEL: define void @foo( |
| 62 | +; GFX906-SAME: ) #[[ATTR0]] { |
| 63 | +; GFX906-NEXT: [[ENTRY:.*:]] |
| 64 | +; GFX906-NEXT: call void @non_predicated_uses() |
| 65 | +; GFX906-NEXT: br label %[[NOT_GFX1201:.*]] |
| 66 | +; GFX906: [[NOT_GFX1201]]: |
| 67 | +; GFX906-NEXT: br label %[[GFX906:.*]] |
| 68 | +; GFX906: [[GFX906]]: |
| 69 | +; GFX906-NEXT: call void @remove_on_1201() |
| 70 | +; GFX906-NEXT: br label %[[END:.*]] |
| 71 | +; GFX906: [[END]]: |
| 72 | +; GFX906-NEXT: ret void |
| 73 | +; |
| 74 | +; GFX1201-LABEL: define void @foo( |
| 75 | +; GFX1201-SAME: ) #[[ATTR0]] { |
| 76 | +; GFX1201-NEXT: [[ENTRY:.*:]] |
| 77 | +; GFX1201-NEXT: call void @non_predicated_uses() |
| 78 | +; GFX1201-NEXT: br label %[[GFX1201:.*]] |
| 79 | +; GFX1201: [[GFX1201]]: |
| 80 | +; GFX1201-NEXT: call void @remove_on_906() |
| 81 | +; GFX1201-NEXT: br label %[[END:.*]] |
| 82 | +; GFX1201: [[END]]: |
| 83 | +; GFX1201-NEXT: ret void |
| 84 | +; |
| 85 | +entry: |
| 86 | + call void @non_predicated_uses() |
| 87 | + %0 = load i1, ptr addrspace(1) @llvm.amdgcn.is.gfx1201, align 1 |
| 88 | + br i1 %0, label %gfx1201, label %not.gfx1201 |
| 89 | + |
| 90 | +gfx1201: |
| 91 | + call void @remove_on_906() |
| 92 | + br label %end |
| 93 | + |
| 94 | +not.gfx1201: |
| 95 | + %1 = load i1, ptr addrspace(1) @llvm.amdgcn.is.gfx906, align 1 |
| 96 | + br i1 %1, label %gfx906, label %end |
| 97 | + |
| 98 | +gfx906: |
| 99 | + call void @remove_on_1201() |
| 100 | + br label %end |
| 101 | + |
| 102 | +end: |
| 103 | + ret void |
| 104 | +} |
0 commit comments