xref: /llvm-project/llvm/test/CodeGen/AMDGPU/remove-incompatible-gws.ll (revision b1bcb7ca460fcd317bbc8309e14c8761bf8394e0)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=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 -mtriple=amdgcn -mcpu=gfx1030 -verify-machineinstrs < %s
6
7; RUN: llc -mtriple=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 -mtriple=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
33define 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(
40define void @gws_caller(i32 %val0, i32 %val1) {
41  call void @needs_gws(i32 %val0, i32 %val1)
42  ret void
43}
44
45declare void @llvm.amdgcn.ds.gws.barrier(i32, i32) #1
46declare void @llvm.amdgcn.ds.gws.init(i32, i32) #2
47
48
49attributes #0 = { "target-features"="+gws"}
50attributes #1 = { convergent inaccessiblememonly nounwind }
51attributes #2 = { convergent inaccessiblememonly nounwind writeonly }
52;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
53; COMPATIBLE: {{.*}}
54; INCOMPATIBLE: {{.*}}
55; IR: {{.*}}
56