|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| 2 | +; RUN: llc -march=amdgcn -mcpu=gfx1030 -stop-after=amdgpu-remove-incompatible-functions\ |
| 3 | +; RUN: -pass-remarks=amdgpu-remove-incompatible-functions %s -o - 2>%t | FileCheck -check-prefixes=COMPATIBLE,IR %s |
| 4 | +; RUN: FileCheck -allow-empty --check-prefix=WARN-COMPATIBLE %s < %t |
| 5 | +; RUN: llc -march=amdgcn -mcpu=gfx1030 -verify-machineinstrs < %s |
| 6 | + |
| 7 | +; RUN: llc -march=amdgcn -mcpu=gfx1200 -stop-after=amdgpu-remove-incompatible-functions\ |
| 8 | +; RUN: -pass-remarks=amdgpu-remove-incompatible-functions %s -o - 2>%t | FileCheck -check-prefixes=INCOMPATIBLE,IR %s |
| 9 | +; RUN: FileCheck --check-prefixes=WARN-INCOMPATIBLE %s < %t |
| 10 | +; RUN: llc -march=amdgcn -mcpu=gfx1200 -verify-machineinstrs < %s |
| 11 | + |
| 12 | +; Note: This test checks the IR, but also has a run line to codegen the file just to check we |
| 13 | +; do not crash when trying to select those functions. |
| 14 | + |
| 15 | +; WARN-COMPATIBLE-NOT: removing function 'needs_gws': |
| 16 | +; WARN-INCOMPATIBLE: removing function 'needs_gws': +gws is not supported on the current target |
| 17 | + |
| 18 | + |
| 19 | +; COMPATIBLE: @GVRefs {{.*}} [ptr @needs_gws] |
| 20 | +; INCOMPATIBLE: @GVRefs {{.*}} zeroinitializer |
| 21 | +@GVRefs = internal global [1 x ptr] [ |
| 22 | + ptr @needs_gws |
| 23 | +] |
| 24 | + |
| 25 | + |
| 26 | +; COMPATIBLE: @ConstantExpr = internal global i64 ptrtoint (ptr @needs_gws to i64) |
| 27 | +; INCOMPATIBLE: @ConstantExpr = internal global i64 0 |
| 28 | +@ConstantExpr = internal global i64 ptrtoint (ptr @needs_gws to i64) |
| 29 | + |
| 30 | + |
| 31 | +; COMPATIBLE: define void @needs_gws |
| 32 | +; INCOMPATIBLE-NOT: define void @needs_gws |
| 33 | +define void @needs_gws(i32 %val0, i32 %val1) #0 { |
| 34 | + call void @llvm.amdgcn.ds.gws.init(i32 %val0, i32 %val1) |
| 35 | + call void @llvm.amdgcn.ds.gws.barrier(i32 %val0, i32 %val1) |
| 36 | + ret void |
| 37 | +} |
| 38 | + |
| 39 | +; IR: define void @gws_caller( |
| 40 | +define void @gws_caller(i32 %val0, i32 %val1) { |
| 41 | + ; COMPATIBLE: call void @needs_gws( |
| 42 | + ; INCOMPATIBLE: call void null |
| 43 | + call void @needs_gws(i32 %val0, i32 %val1) |
| 44 | + ; IR: ret void |
| 45 | + ret void |
| 46 | +} |
| 47 | + |
| 48 | +declare void @llvm.amdgcn.ds.gws.barrier(i32, i32) #1 |
| 49 | +declare void @llvm.amdgcn.ds.gws.init(i32, i32) #2 |
| 50 | + |
| 51 | + |
| 52 | +attributes #0 = { "target-features"="+gws"} |
| 53 | +attributes #1 = { convergent inaccessiblememonly nounwind } |
| 54 | +attributes #2 = { convergent inaccessiblememonly nounwind writeonly } |
0 commit comments