1# RUN: llc -march=amdgcn -mcpu=kaveri -run-pass=si-peephole-sdwa -o - %s | FileCheck -check-prefix=CI -check-prefix=GCN %s
2# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=si-peephole-sdwa -o - %s | FileCheck -check-prefix=VI -check-prefix=GCN %s
3# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=si-peephole-sdwa -o - %s | FileCheck -check-prefix=GFX9 -check-prefix=GCN %s
4
5# No conversion for VOP2 instructions that have only 64-bit encoding
6
7# GCN-LABEL: {{^}}name: vop2_64bit
8
9# GCN: %{{[0-9]+}}:vgpr_32 = V_BCNT_U32_B32_e64 %{{[0-9]+}}, killed %{{[0-9]+}}, implicit-def $vcc, implicit $exec
10# GCN: %{{[0-9]+}}:vgpr_32 = V_BFM_B32_e64 %{{[0-9]+}}, killed %{{[0-9]+}}, implicit-def $vcc, implicit $exec
11# GCN: %{{[0-9]+}}:vgpr_32 = V_CVT_PKNORM_I16_F32_e64 0, %{{[0-9]+}}, 0, killed %{{[0-9]+}}, 0, implicit-def $vcc, implicit $exec
12# GCN: %{{[0-9]+}}:sgpr_32 = V_READLANE_B32 killed %{{[0-9]+}}, 0, implicit-def $vcc, implicit $exec
13
14---
15name:            vop2_64bit
16tracksRegLiveness: true
17registers:
18  - { id: 0, class: vreg_64 }
19  - { id: 1, class: vreg_64 }
20  - { id: 2, class: sreg_64 }
21  - { id: 3, class: vgpr_32 }
22  - { id: 4, class: sreg_32_xm0 }
23  - { id: 5, class: sreg_32_xm0 }
24  - { id: 6, class: sreg_32 }
25  - { id: 7, class: sreg_32_xm0 }
26  - { id: 8, class: sreg_32 }
27  - { id: 9, class: vgpr_32 }
28  - { id: 12, class: vgpr_32 }
29  - { id: 13, class: vgpr_32 }
30  - { id: 14, class: vgpr_32 }
31  - { id: 15, class: vgpr_32 }
32  - { id: 16, class: vgpr_32 }
33  - { id: 17, class: vgpr_32 }
34  - { id: 18, class: vgpr_32 }
35  - { id: 19, class: sgpr_32 }
36  - { id: 20, class: vgpr_32 }
37body:             |
38  bb.0:
39    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $sgpr30_sgpr31
40
41    %2 = COPY $sgpr30_sgpr31
42    %1 = COPY $vgpr2_vgpr3
43    %0 = COPY $vgpr0_vgpr1
44    %3 = FLAT_LOAD_DWORD %1, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (load 4)
45
46    %12 = V_LSHRREV_B32_e64 16, %3, implicit $exec
47    %13 = V_BCNT_U32_B32_e64 %3, killed %12, implicit-def $vcc, implicit $exec
48
49    %14 = V_LSHRREV_B32_e64 16, %13, implicit $exec
50    %15 = V_BFM_B32_e64 %13, killed %14, implicit-def $vcc, implicit $exec
51
52    %16 = V_LSHRREV_B32_e64 16, %15, implicit $exec
53    %17 = V_CVT_PKNORM_I16_F32_e64 0, %15, 0, killed %16, 0, implicit-def $vcc, implicit $exec
54
55    %18 = V_LSHRREV_B32_e64 16, %17, implicit $exec
56    %19 = V_READLANE_B32 killed %18, 0, implicit-def $vcc, implicit $exec
57    %20 = V_MOV_B32_e64 %19, implicit $exec
58
59    FLAT_STORE_DWORD %0, %20, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4)
60    $sgpr30_sgpr31 = COPY %2
61    S_SETPC_B64_return $sgpr30_sgpr31
62