1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx950 < %s | FileCheck -check-prefix=GCN %s
3 ; RUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx950 < %s | FileCheck -check-prefix=GCN %s
5 ; RUN: not --crash llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 -filetype=null %s 2>&1 | FileCheck -check-prefix=ERR-SDAG %s
6 ; RUN: not --crash llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 -filetype=null %s 2>&1 | FileCheck -check-prefix=ERR-GISEL %s
8 ; ERR-SDAG: LLVM ERROR: Cannot select: intrinsic %llvm.amdgcn.permlane32.swap
9 ; ERR-GISEL: LLVM ERROR: cannot select: %{{[0-9]+}}:vgpr_32(s32), %{{[0-9]+}}:vgpr_32(s32) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.permlane32.swap)
12 declare { i32, i32 } @llvm.amdgcn.permlane32.swap(i32, i32, i1 immarg, i1 immarg)
14 define { i32, i32 } @v_permlane32_swap_b32_vv(i32 %vdst_old, i32 %src0_old) {
15 ; GCN-LABEL: v_permlane32_swap_b32_vv:
17 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18 ; GCN-NEXT: v_permlane32_swap_b32_e32 v0, v1
19 ; GCN-NEXT: s_setpc_b64 s[30:31]
20 %v = call { i32, i32 } @llvm.amdgcn.permlane32.swap(i32 %vdst_old, i32 %src0_old, i1 false, i1 false)
24 define { i32, i32 } @v_permlane32_swap_b32_vi(i32 %vdst_old) {
25 ; GCN-LABEL: v_permlane32_swap_b32_vi:
27 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
28 ; GCN-NEXT: v_mov_b32_e32 v1, 1
30 ; GCN-NEXT: v_permlane32_swap_b32_e32 v0, v1
31 ; GCN-NEXT: s_setpc_b64 s[30:31]
32 %v = call { i32, i32 } @llvm.amdgcn.permlane32.swap(i32 %vdst_old, i32 1, i1 false, i1 false)
36 define { i32, i32 } @v_permlane32_swap_b32_vl(i32 %vdst_old) {
37 ; GCN-LABEL: v_permlane32_swap_b32_vl:
39 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
40 ; GCN-NEXT: v_mov_b32_e32 v1, 0xc1d1
42 ; GCN-NEXT: v_permlane32_swap_b32_e32 v0, v1
43 ; GCN-NEXT: s_setpc_b64 s[30:31]
44 %v = call { i32, i32 } @llvm.amdgcn.permlane32.swap(i32 %vdst_old, i32 49617, i1 false, i1 false)
48 define { i32, i32 } @v_permlane32_swap_b32_iv(i32 %src0_old) {
49 ; GCN-LABEL: v_permlane32_swap_b32_iv:
51 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
52 ; GCN-NEXT: v_mov_b32_e32 v1, v0
53 ; GCN-NEXT: v_mov_b32_e32 v0, 1
55 ; GCN-NEXT: v_permlane32_swap_b32_e32 v0, v1
56 ; GCN-NEXT: s_setpc_b64 s[30:31]
57 %v = call { i32, i32 } @llvm.amdgcn.permlane32.swap(i32 1, i32 %src0_old, i1 false, i1 false)
61 define { i32, i32 } @v_permlane32_swap_b32_ss(i32 inreg %vdst_old, i32 inreg %src0_old) {
62 ; GCN-LABEL: v_permlane32_swap_b32_ss:
64 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
65 ; GCN-NEXT: v_mov_b32_e32 v0, s0
66 ; GCN-NEXT: v_mov_b32_e32 v1, s1
68 ; GCN-NEXT: v_permlane32_swap_b32_e32 v0, v1
69 ; GCN-NEXT: s_setpc_b64 s[30:31]
70 %v = call { i32, i32 } @llvm.amdgcn.permlane32.swap(i32 %vdst_old, i32 %src0_old, i1 false, i1 false)
74 define { i32, i32 } @v_permlane32_swap_b32_sv(i32 inreg %vdst_old, i32 %src0_old) {
75 ; GCN-LABEL: v_permlane32_swap_b32_sv:
77 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
78 ; GCN-NEXT: v_mov_b32_e32 v1, v0
79 ; GCN-NEXT: v_mov_b32_e32 v0, s0
81 ; GCN-NEXT: v_permlane32_swap_b32_e32 v0, v1
82 ; GCN-NEXT: s_setpc_b64 s[30:31]
83 %v = call { i32, i32 } @llvm.amdgcn.permlane32.swap(i32 %vdst_old, i32 %src0_old, i1 false, i1 false)
87 define { i32, i32 } @v_permlane32_swap_b32_vs(i32 %vdst_old, i32 inreg %src0_old) {
88 ; GCN-LABEL: v_permlane32_swap_b32_vs:
90 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
91 ; GCN-NEXT: v_mov_b32_e32 v1, s0
93 ; GCN-NEXT: v_permlane32_swap_b32_e32 v0, v1
94 ; GCN-NEXT: s_setpc_b64 s[30:31]
95 %v = call { i32, i32 } @llvm.amdgcn.permlane32.swap(i32 %vdst_old, i32 %src0_old, i1 false, i1 false)
99 define { i32, i32 } @v_permlane32_swap_b32_vv_fi(i32 %vdst_old, i32 %src0_old) {
100 ; GCN-LABEL: v_permlane32_swap_b32_vv_fi:
102 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
103 ; GCN-NEXT: v_permlane32_swap_b32_e64 v0, v1 fi:1
104 ; GCN-NEXT: s_setpc_b64 s[30:31]
105 %v = call { i32, i32 } @llvm.amdgcn.permlane32.swap(i32 %vdst_old, i32 %src0_old, i1 true, i1 false)
109 define { i32, i32 } @v_permlane32_swap_b32_vv_bc(i32 %vdst_old, i32 %src0_old) {
110 ; GCN-LABEL: v_permlane32_swap_b32_vv_bc:
112 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
113 ; GCN-NEXT: v_permlane32_swap_b32_e64 v0, v1 bound_ctrl:1
114 ; GCN-NEXT: s_setpc_b64 s[30:31]
115 %v = call { i32, i32 } @llvm.amdgcn.permlane32.swap(i32 %vdst_old, i32 %src0_old, i1 false, i1 true)
119 define { i32, i32 } @v_permlane32_swap_b32_vv_fi_bc(i32 %vdst_old, i32 %src0_old) {
120 ; GCN-LABEL: v_permlane32_swap_b32_vv_fi_bc:
122 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
123 ; GCN-NEXT: v_permlane32_swap_b32_e64 v0, v1 bound_ctrl:1 fi:1
124 ; GCN-NEXT: s_setpc_b64 s[30:31]
125 %v = call { i32, i32 } @llvm.amdgcn.permlane32.swap(i32 %vdst_old, i32 %src0_old, i1 true, i1 true)