1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -mcpu=tahiti -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX6 %s
3 # RUN: llc -mtriple=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX7 %s
4 # RUN: llc -mtriple=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX7 %s
5 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX9 %s
6 # RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX9 %s
7 # RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX9 %s
11 name: atomicrmw_xchg_s32_local
14 tracksRegLiveness: true
17 liveins: $vgpr0, $vgpr1
19 ; GFX6-LABEL: name: atomicrmw_xchg_s32_local
20 ; GFX6: liveins: $vgpr0, $vgpr1
22 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
23 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
24 ; GFX6-NEXT: $m0 = S_MOV_B32 -1
25 ; GFX6-NEXT: [[DS_WRXCHG_RTN_B32_:%[0-9]+]]:vgpr_32 = DS_WRXCHG_RTN_B32 [[COPY]], [[COPY1]], 0, 0, implicit $m0, implicit $exec :: (load store seq_cst (s32), addrspace 3)
26 ; GFX6-NEXT: $vgpr0 = COPY [[DS_WRXCHG_RTN_B32_]]
27 ; GFX7-LABEL: name: atomicrmw_xchg_s32_local
28 ; GFX7: liveins: $vgpr0, $vgpr1
30 ; GFX7-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
31 ; GFX7-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
32 ; GFX7-NEXT: $m0 = S_MOV_B32 -1
33 ; GFX7-NEXT: [[DS_WRXCHG_RTN_B32_:%[0-9]+]]:vgpr_32 = DS_WRXCHG_RTN_B32 [[COPY]], [[COPY1]], 0, 0, implicit $m0, implicit $exec :: (load store seq_cst (s32), addrspace 3)
34 ; GFX7-NEXT: $vgpr0 = COPY [[DS_WRXCHG_RTN_B32_]]
35 ; GFX9-LABEL: name: atomicrmw_xchg_s32_local
36 ; GFX9: liveins: $vgpr0, $vgpr1
38 ; GFX9-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
39 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
40 ; GFX9-NEXT: [[DS_WRXCHG_RTN_B32_gfx9_:%[0-9]+]]:vgpr_32 = DS_WRXCHG_RTN_B32_gfx9 [[COPY]], [[COPY1]], 0, 0, implicit $exec :: (load store seq_cst (s32), addrspace 3)
41 ; GFX9-NEXT: $vgpr0 = COPY [[DS_WRXCHG_RTN_B32_gfx9_]]
42 %0:vgpr(p3) = COPY $vgpr0
43 %1:vgpr(s32) = COPY $vgpr1
44 %2:vgpr(s32) = G_ATOMICRMW_XCHG %0(p3), %1 :: (load store seq_cst (s32), addrspace 3)
50 name: atomicrmw_xchg_s32_local_gep4
53 tracksRegLiveness: true
56 liveins: $vgpr0, $vgpr1
58 ; GFX6-LABEL: name: atomicrmw_xchg_s32_local_gep4
59 ; GFX6: liveins: $vgpr0, $vgpr1
61 ; GFX6-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
62 ; GFX6-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
63 ; GFX6-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 4, implicit $exec
64 ; GFX6-NEXT: %3:vgpr_32, dead %5:sreg_64_xexec = V_ADD_CO_U32_e64 [[COPY]], [[V_MOV_B32_e32_]], 0, implicit $exec
65 ; GFX6-NEXT: $m0 = S_MOV_B32 -1
66 ; GFX6-NEXT: [[DS_WRXCHG_RTN_B32_:%[0-9]+]]:vgpr_32 = DS_WRXCHG_RTN_B32 %3, [[COPY1]], 0, 0, implicit $m0, implicit $exec :: (load store seq_cst (s32), addrspace 3)
67 ; GFX6-NEXT: $vgpr0 = COPY [[DS_WRXCHG_RTN_B32_]]
68 ; GFX7-LABEL: name: atomicrmw_xchg_s32_local_gep4
69 ; GFX7: liveins: $vgpr0, $vgpr1
71 ; GFX7-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
72 ; GFX7-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
73 ; GFX7-NEXT: $m0 = S_MOV_B32 -1
74 ; GFX7-NEXT: [[DS_WRXCHG_RTN_B32_:%[0-9]+]]:vgpr_32 = DS_WRXCHG_RTN_B32 [[COPY]], [[COPY1]], 4, 0, implicit $m0, implicit $exec :: (load store seq_cst (s32), addrspace 3)
75 ; GFX7-NEXT: $vgpr0 = COPY [[DS_WRXCHG_RTN_B32_]]
76 ; GFX9-LABEL: name: atomicrmw_xchg_s32_local_gep4
77 ; GFX9: liveins: $vgpr0, $vgpr1
79 ; GFX9-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
80 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
81 ; GFX9-NEXT: [[DS_WRXCHG_RTN_B32_gfx9_:%[0-9]+]]:vgpr_32 = DS_WRXCHG_RTN_B32_gfx9 [[COPY]], [[COPY1]], 4, 0, implicit $exec :: (load store seq_cst (s32), addrspace 3)
82 ; GFX9-NEXT: $vgpr0 = COPY [[DS_WRXCHG_RTN_B32_gfx9_]]
83 %0:vgpr(p3) = COPY $vgpr0
84 %1:vgpr(s32) = COPY $vgpr1
85 %2:vgpr(s32) = G_CONSTANT i32 4
86 %3:vgpr(p3) = G_PTR_ADD %0, %2
87 %4:vgpr(s32) = G_ATOMICRMW_XCHG %3(p3), %1 :: (load store seq_cst (s32), addrspace 3)