brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.3 KiB · 7c032c2 Raw
163 lines · plain
1# RUN: llc -mtriple=amdgcn -verify-machineinstrs -run-pass si-shrink-instructions -o - %s | FileCheck -check-prefix=GCN %s2# RUN: llc -mtriple=amdgcn -verify-machineinstrs -passes si-shrink-instructions -o - %s | FileCheck -check-prefix=GCN %s3--- |4 5  define amdgpu_kernel void @fold_fi_vgpr() {6    %alloca = alloca [4 x i32], addrspace(5)7    ret void8  }9 10  define amdgpu_kernel void @fold_vgpr_fi() {11    %alloca = alloca [4 x i32], addrspace(5)12    ret void13  }14 15  define amdgpu_kernel void @fold_sgpr_fi() {16    %alloca = alloca [4 x i32], addrspace(5)17    ret void18  }19 20  define amdgpu_kernel void @fold_fi_sgpr() {21    %alloca = alloca [4 x i32], addrspace(5)22    ret void23  }24 25  define amdgpu_kernel void @fold_fi_imm() {26    %alloca = alloca [4 x i32], addrspace(5)27    ret void28  }29 30  define amdgpu_kernel void @fold_imm_fi() {31    %alloca = alloca [4 x i32], addrspace(5)32    ret void33  }34 35...36# GCN-LABEL: name: fold_fi_vgpr{{$}}37# GCN: %1:vgpr_32 = IMPLICIT_DEF38 39# GCN: %2:vgpr_32 = V_ADD_CO_U32_e32 %stack.0.alloca, %1, implicit-def $vcc, implicit $exec40name: fold_fi_vgpr41tracksRegLiveness: true42registers:43  - { id: 0, class: vgpr_32 }44  - { id: 1, class: vgpr_32 }45  - { id: 2, class: vgpr_32 }46stack:47  - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,48      callee-saved-register: '', local-offset: 0, debug-info-variable: '',49      debug-info-expression: '', debug-info-location: '' }50body:             |51  bb.0:52    %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec53    %1 = IMPLICIT_DEF54    %2, $vcc = V_ADD_CO_U32_e64 %0, %1, 0, implicit $exec55    S_ENDPGM 056 57...58# GCN-LABEL: name: fold_vgpr_fi{{$}}59# GCN: %1:vgpr_32 = IMPLICIT_DEF60# GCN: %2:vgpr_32 = V_ADD_CO_U32_e32 %stack.0.alloca, %1, implicit-def $vcc, implicit $exec61name: fold_vgpr_fi62tracksRegLiveness: true63registers:64  - { id: 0, class: vgpr_32 }65  - { id: 1, class: vgpr_32 }66  - { id: 2, class: vgpr_32 }67stack:68  - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,69      callee-saved-register: '', local-offset: 0, debug-info-variable: '',70      debug-info-expression: '', debug-info-location: '' }71body:             |72  bb.0:73    %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec74    %1 = IMPLICIT_DEF75    %2, $vcc = V_ADD_CO_U32_e64 %1, %0, 0, implicit $exec76    S_ENDPGM 077 78...79# GCN-LABEL: name: fold_sgpr_fi{{$}}80# GCN: %0:vgpr_32 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec81# GCN: %1:sgpr_32 = IMPLICIT_DEF82# GCN: %2:vgpr_32 = V_ADD_CO_U32_e32 %1, %0, implicit-def $vcc, implicit $exec83name: fold_sgpr_fi84tracksRegLiveness: true85registers:86  - { id: 0, class: vgpr_32 }87  - { id: 1, class: sgpr_32 }88  - { id: 2, class: vgpr_32 }89stack:90  - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,91      callee-saved-register: '', local-offset: 0, debug-info-variable: '',92      debug-info-expression: '', debug-info-location: '' }93body:             |94  bb.0:95    %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec96    %1 = IMPLICIT_DEF97    %2, $vcc = V_ADD_CO_U32_e64 %1, %0, 0, implicit $exec98    S_ENDPGM 099 100...101# GCN-LABEL: name: fold_fi_sgpr{{$}}102# GCN: %0:vgpr_32 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec103# GCN: %1:sgpr_32 = IMPLICIT_DEF104# GCN: %2:vgpr_32 = V_ADD_CO_U32_e32 %1, %0, implicit-def $vcc, implicit $exec105name: fold_fi_sgpr106tracksRegLiveness: true107registers:108  - { id: 0, class: vgpr_32 }109  - { id: 1, class: sgpr_32 }110  - { id: 2, class: vgpr_32 }111stack:112  - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,113      callee-saved-register: '', local-offset: 0, debug-info-variable: '',114      debug-info-expression: '', debug-info-location: '' }115body:             |116  bb.0:117    %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec118    %1 = IMPLICIT_DEF119    %2, $vcc = V_ADD_CO_U32_e64 %0, %1, 0, implicit $exec120    S_ENDPGM 0121...122# TODO: Should probably prefer folding immediate first123# GCN-LABEL: name: fold_fi_imm{{$}}124# GCN: %1:vgpr_32 = V_MOV_B32_e32 999, implicit $exec125# GCN: %2:vgpr_32 = V_ADD_CO_U32_e32 %stack.0.alloca, %1, implicit-def $vcc, implicit $exec126name: fold_fi_imm127tracksRegLiveness: true128registers:129  - { id: 0, class: vgpr_32 }130  - { id: 1, class: vgpr_32 }131  - { id: 2, class: vgpr_32 }132stack:133  - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,134      callee-saved-register: '', local-offset: 0, debug-info-variable: '',135      debug-info-expression: '', debug-info-location: '' }136body:             |137  bb.0:138    %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec139    %1 = V_MOV_B32_e32 999, implicit $exec140    %2, $vcc = V_ADD_CO_U32_e64 %0, %1, 0, implicit $exec141    S_ENDPGM 0142 143...144# GCN-LABEL: name: fold_imm_fi{{$}}145# GCN: %0:vgpr_32 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec146# GCN: %2:vgpr_32 = V_ADD_CO_U32_e32 999, %0, implicit-def $vcc, implicit $exec147name: fold_imm_fi148tracksRegLiveness: true149registers:150  - { id: 0, class: vgpr_32 }151  - { id: 1, class: vgpr_32 }152  - { id: 2, class: vgpr_32 }153stack:154  - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,155      callee-saved-register: '', local-offset: 0, debug-info-variable: '',156      debug-info-expression: '', debug-info-location: '' }157body:             |158  bb.0:159    %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec160    %1 = V_MOV_B32_e32 999, implicit $exec161    %2, $vcc = V_ADD_CO_U32_e64 %1, %0, 0, implicit $exec162    S_ENDPGM 0163