• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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# GCN-LABEL: {{^}}name: add_shr_i32
6# GCN: [[SMOV:%[0-9]+]]:sreg_32_xm0 = S_MOV_B32 123
7
8# CI: [[SHIFT:%[0-9]+]]:vgpr_32 = V_LSHRREV_B32_e64 16, %{{[0-9]+}}, implicit $exec
9# CI: %{{[0-9]+}}:vgpr_32 = V_ADD_CO_U32_e32 [[SMOV]], killed [[SHIFT]], implicit-def $vcc, implicit $exec
10
11# VI: [[VMOV:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 [[SMOV]], implicit $exec
12# VI: %{{[0-9]+}}:vgpr_32 = V_ADD_CO_U32_sdwa 0, [[VMOV]], 0, %{{[0-9]+}}, 0, 6, 0, 6, 5, implicit-def $vcc, implicit $exec
13
14# GFX9: %{{[0-9]+}}:vgpr_32 = V_ADD_CO_U32_sdwa 0, [[SMOV]], 0, %{{[0-9]+}}, 0, 6, 0, 6, 5, implicit-def $vcc, implicit $exec
15
16---
17name:            add_shr_i32
18tracksRegLiveness: true
19registers:
20  - { id: 0, class: vreg_64 }
21  - { id: 1, class: vreg_64 }
22  - { id: 2, class: sreg_64 }
23  - { id: 3, class: vgpr_32 }
24  - { id: 4, class: sreg_32_xm0 }
25  - { id: 5, class: sreg_32_xm0 }
26  - { id: 6, class: sreg_32 }
27  - { id: 7, class: sreg_32_xm0 }
28  - { id: 8, class: sreg_32 }
29  - { id: 9, class: vgpr_32 }
30  - { id: 10, class: vgpr_32 }
31  - { id: 11, class: vgpr_32 }
32  - { id: 12, class: sreg_32_xm0 }
33body:             |
34  bb.0:
35    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $sgpr30_sgpr31
36
37    %2 = COPY $sgpr30_sgpr31
38    %1 = COPY $vgpr2_vgpr3
39    %0 = COPY $vgpr0_vgpr1
40    %3 = FLAT_LOAD_DWORD %1, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (load 4)
41    %12 = S_MOV_B32 123
42    %10 = V_LSHRREV_B32_e64 16, %3, implicit $exec
43    %11 = V_ADD_CO_U32_e32 %12, killed %10, implicit-def $vcc, implicit $exec
44    FLAT_STORE_DWORD %0, %11, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4)
45    $sgpr30_sgpr31 = COPY %2
46    S_SETPC_B64_return $sgpr30_sgpr31
47
48...
49
50# GCN-LABEL: {{^}}name: trunc_shr_f32
51
52# CI: [[SHIFT:%[0-9]+]]:vgpr_32 = V_LSHRREV_B32_e64 16, %{{[0-9]+}}, implicit $exec
53# CI: %{{[0-9]+}}:vgpr_32 = V_TRUNC_F32_e64 0, killed [[SHIFT]], 1, 2, implicit $mode, implicit $exec, implicit-def $vcc
54
55# VI: [[SHIFT:%[0-9]+]]:vgpr_32 = V_LSHRREV_B32_e64 16, %{{[0-9]+}}, implicit $exec
56# VI: %{{[0-9]+}}:vgpr_32 = V_TRUNC_F32_e64 0, killed [[SHIFT]], 1, 2, implicit $mode, implicit $exec, implicit-def $vcc
57
58# GFX9: %{{[0-9]+}}:vgpr_32 = V_TRUNC_F32_sdwa 0, %{{[0-9]+}}, 1, 2, 6, 0, 5, implicit $mode, implicit $exec
59
60---
61name:            trunc_shr_f32
62tracksRegLiveness: true
63registers:
64  - { id: 0, class: vreg_64 }
65  - { id: 1, class: vreg_64 }
66  - { id: 2, class: sreg_64 }
67  - { id: 3, class: vgpr_32 }
68  - { id: 4, class: sreg_32_xm0 }
69  - { id: 5, class: sreg_32_xm0 }
70  - { id: 6, class: sreg_32 }
71  - { id: 7, class: sreg_32_xm0 }
72  - { id: 8, class: sreg_32 }
73  - { id: 9, class: vgpr_32 }
74  - { id: 10, class: vgpr_32 }
75  - { id: 11, class: vgpr_32 }
76body:             |
77  bb.0:
78    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $sgpr30_sgpr31
79
80    %2 = COPY $sgpr30_sgpr31
81    %1 = COPY $vgpr2_vgpr3
82    %0 = COPY $vgpr0_vgpr1
83    %3 = FLAT_LOAD_DWORD %1, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (load 4)
84    %10 = V_LSHRREV_B32_e64 16, %3, implicit $exec
85    %11 = V_TRUNC_F32_e64 0, killed %10, 1, 2, implicit $mode, implicit $exec, implicit-def $vcc
86    FLAT_STORE_DWORD %0, %11, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (store 4)
87    $sgpr30_sgpr31 = COPY %2
88    S_SETPC_B64_return $sgpr30_sgpr31
89