1// RUN: %clang_cc1 -triple amdgcn-- -target-cpu tahiti -O0 -emit-llvm -o - %s | FileCheck %s
2// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O0 -emit-llvm -verify -o - %s | FileCheck -check-prefix=X86 %s
3
4// Make sure this is silently accepted on other targets.
5
6__attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics
7kernel void test_num_vgpr64() {
8// CHECK: define amdgpu_kernel void @test_num_vgpr64() [[ATTR_VGPR64:#[0-9]+]]
9}
10
11__attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics
12kernel void test_num_sgpr32() {
13// CHECK: define amdgpu_kernel void @test_num_sgpr32() [[ATTR_SGPR32:#[0-9]+]]
14}
15
16__attribute__((amdgpu_num_vgpr(64), amdgpu_num_sgpr(32))) // expected-no-diagnostics
17kernel void test_num_vgpr64_sgpr32() {
18// CHECK: define amdgpu_kernel void @test_num_vgpr64_sgpr32() [[ATTR_VGPR64_SGPR32:#[0-9]+]]
19
20}
21
22__attribute__((amdgpu_num_sgpr(20), amdgpu_num_vgpr(40))) // expected-no-diagnostics
23kernel void test_num_sgpr20_vgpr40() {
24// CHECK: define amdgpu_kernel void @test_num_sgpr20_vgpr40() [[ATTR_SGPR20_VGPR40:#[0-9]+]]
25}
26
27__attribute__((amdgpu_num_vgpr(0))) // expected-no-diagnostics
28kernel void test_num_vgpr0() {
29}
30
31__attribute__((amdgpu_num_sgpr(0))) // expected-no-diagnostics
32kernel void test_num_sgpr0() {
33}
34
35__attribute__((amdgpu_num_vgpr(0), amdgpu_num_sgpr(0))) // expected-no-diagnostics
36kernel void test_num_vgpr0_sgpr0() {
37}
38
39
40// X86-NOT: "amdgpu_num_vgpr"
41// X86-NOT: "amdgpu_num_sgpr"
42
43// CHECK-NOT: "amdgpu_num_vgpr"="0"
44// CHECK-NOT: "amdgpu_num_sgpr"="0"
45// CHECK-DAG: attributes [[ATTR_VGPR64]] = { nounwind "amdgpu_num_vgpr"="64"
46// CHECK-DAG: attributes [[ATTR_SGPR32]] = { nounwind "amdgpu_num_sgpr"="32"
47// CHECK-DAG: attributes [[ATTR_VGPR64_SGPR32]] = { nounwind "amdgpu_num_sgpr"="32" "amdgpu_num_vgpr"="64"
48// CHECK-DAG: attributes [[ATTR_SGPR20_VGPR40]] = { nounwind "amdgpu_num_sgpr"="20" "amdgpu_num_vgpr"="40"
49