xref: /llvm-project/llvm/test/CodeGen/AMDGPU/remove-incompatible-wave32-feature.ll (revision 7bf1cb702bdbec4b054a65cb58244596e8cd4138)
1; RUN: llc -mtriple=amdgcn -mcpu=gfx906 -mattr=+wavefrontsize64 -stop-after=amdgpu-remove-incompatible-functions\
2; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX906 %s
3; RUN: FileCheck --check-prefix=WARN-GFX906 %s < %t
4; RUN: llc -mtriple=amdgcn -mcpu=gfx906 -mattr=+wavefrontsize64 -verify-machineinstrs < %s
5
6; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -mattr=+wavefrontsize64 -stop-after=amdgpu-remove-incompatible-functions\
7; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX90A %s
8; RUN: FileCheck --check-prefix=WARN-GFX90A %s < %t
9; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -mattr=+wavefrontsize64 -verify-machineinstrs < %s
10
11; RUN: llc -mtriple=amdgcn -mcpu=gfx1011 -mattr=-wavefrontsize32,+wavefrontsize64 -stop-after=amdgpu-remove-incompatible-functions\
12; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX10 %s
13; RUN: llc -mtriple=amdgcn -mcpu=gfx1011 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs < %s
14
15; RUN: llc -enable-new-pm -mtriple=amdgcn -mcpu=gfx1011 -mattr=-wavefrontsize32,+wavefrontsize64 -stop-after=amdgpu-remove-incompatible-functions\
16; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX10 %s
17; RUN: llc -enable-new-pm -mtriple=amdgcn -mcpu=gfx1011 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs < %s
18
19; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 -stop-after=amdgpu-remove-incompatible-functions\
20; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX11 %s
21; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs < %s
22
23; RUN: llc -enable-new-pm -mtriple=amdgcn -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 -stop-after=amdgpu-remove-incompatible-functions\
24; RUN:   -pass-remarks=amdgpu-remove-incompatible-functions < %s 2>%t | FileCheck -check-prefixes=GFX11 %s
25; RUN: llc -enable-new-pm -mtriple=amdgcn -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs < %s
26
27; WARN-GFX906: removing function 'needs_wavefrontsize32': +wavefrontsize32 is not supported on the current target
28; WARN-GFX906-NOT: not supported
29
30; WARN-GFX90A: removing function 'needs_wavefrontsize32': +wavefrontsize32 is not supported on the current target
31; WARN-GFX90A-NOT: not supported
32
33define void @needs_wavefrontsize32(ptr %out) #0 {
34; GFX906-NOT:   @needs_wavefrontsize32
35; GFX90A-NOT:   @needs_wavefrontsize32
36; GFX10:        define void @needs_wavefrontsize32(
37; GFX11:        define void @needs_wavefrontsize32(
38  %1 = tail call i32 @llvm.read_register.i32(metadata !0)
39  %2 = tail call i32 @llvm.ctpop.i32(i32 %1)
40  store i32 %2, ptr %out, align 4
41  ret void
42}
43
44define void @caller(ptr %out) {
45  ; GFX906: call void null(
46  ; GFX90A: call void null(
47  ; GFX10: call void @needs_wavefrontsize32(
48  ; GFX11: call void @needs_wavefrontsize32(
49  call void @needs_wavefrontsize32(ptr %out)
50  ret void
51}
52
53declare i32 @llvm.read_register.i32(metadata)
54declare i32 @llvm.ctpop.i32(i32)
55
56!0 = !{!"exec_lo"}
57
58attributes #0 = { "target-features"="+wavefrontsize32" }
59