1# RUN: llc -march=amdgcn -mcpu=hawaii -run-pass=none -o - %s | FileCheck -check-prefix=MCPU %s
2# RUN: llc -march=amdgcn -mattr=+unaligned-buffer-access -run-pass=none -o - %s | FileCheck -check-prefix=MATTR %s
3
4# FIXME: This overrides attributes that already are present. It should probably
5# only touch functions without an existing attribute.
6
7# MCPU:  @with_cpu_attr() #0 {
8# MCPU: @no_cpu_attr() #1 {
9
10# MCPU: attributes #0 = { "target-cpu"="fiji" }
11# MCPU: attributes #1 = { "target-cpu"="hawaii" }
12
13# MATTR:  attributes #0 = { "target-cpu"="fiji" "target-features"="+unaligned-buffer-access" }
14# MATTR: attributes #1 = { "target-features"="+unaligned-buffer-access" }
15
16--- |
17  define amdgpu_kernel void @with_cpu_attr() #0 {
18    ret void
19  }
20
21  define amdgpu_kernel void @no_cpu_attr() {
22    ret void
23  }
24
25  attributes #0 = { "target-cpu"="fiji" }
26...
27
28---
29name: with_cpu_attr
30legalized: true
31regBankSelected: true
32tracksRegLiveness: true
33
34body: |
35  bb.0:
36    liveins: $sgpr0, $sgpr1
37
38    %0:sgpr(s32) = COPY $sgpr0
39    %1:sgpr(s32) = COPY $sgpr1
40    %2:vgpr(s32) = G_OR %0, %1
41    S_ENDPGM 0, implicit %2
42...
43
44---
45name: no_cpu_attr
46legalized: true
47regBankSelected: true
48tracksRegLiveness: true
49
50body: |
51  bb.0:
52    liveins: $sgpr0, $sgpr1
53
54    %0:sgpr(s32) = COPY $sgpr0
55    %1:sgpr(s32) = COPY $sgpr1
56    %2:vgpr(s32) = G_OR %0, %1
57    S_ENDPGM 0, implicit %2
58...
59