brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · 47f13cb Raw
90 lines · plain
1# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -mattr=+wavefrontsize64 -run-pass=si-optimize-exec-masking -verify-machineinstrs %s -o - | FileCheck --check-prefixes=GCN,GFX1010 %s2# RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -mattr=+wavefrontsize64 -run-pass=si-optimize-exec-masking -verify-machineinstrs %s -o - | FileCheck --check-prefixes=GCN,GFX1030 %s3---4 5# After the Optimize exec masking (post-RA) pass, there's a change of having v_cmpx instructions6# being introduced whenever there's a sequence of v_cmp and s_and_saveexec instructions7# which can be safely replaced in various cases.8# However, it is not safe to do so when the generated code sequence would omit part of the EXEC mask9# which could occur when a subset of EXEC is used as input operand in the v_cmp instruction.10# The idea behind this test is to check if the subregisters are correctly handled here.11 12# GCN-LABEL: name: vcmp_saveexec_to_mov_vcmpx_exec_subreg13# GCN: V_CMP_GT_U32_e6414# GCN: S_AND_SAVEEXEC_B6415name: vcmp_saveexec_to_mov_vcmpx_exec_subreg16tracksRegLiveness: true17body: |18  bb.0:19    liveins: $vgpr0, $sgpr220    renamable $sgpr0_sgpr1 = V_CMP_GT_U32_e64 $sgpr2, killed $vgpr0, implicit $exec21    $sgpr2_sgpr3 = COPY $exec, implicit-def $exec22    $sgpr2_sgpr3 = S_AND_B64 killed renamable $sgpr2_sgpr3, killed renamable $sgpr0_sgpr1, implicit-def dead $scc23    $exec = S_MOV_B64_term killed renamable $sgpr2_sgpr324...25 26---27 28# Ensure the transformation does not get applied when the v_cmp target is used before the s_and_saveexec instruction.29 30# GCN-LABEL: name: vcmp_saveexec_to_mov_vcmpx_exec_intermediate_use31# GCN: V_CMP_LT_F32_e6432# GCN: V_WRITELANE_B3233# GCN: S_AND_SAVEEXEC_B6434name: vcmp_saveexec_to_mov_vcmpx_exec_intermediate_use35tracksRegLiveness: true36body: |37  bb.0:38    liveins: $vgpr0, $vgpr1, $sgpr239    renamable $sgpr0_sgpr1 = V_CMP_LT_F32_e64 0, 953267991, 2, $vgpr1, 0, implicit $mode, implicit $exec40    $vgpr0 = V_WRITELANE_B32 0, $sgpr0, $vgpr041    $sgpr2_sgpr3 = COPY $exec, implicit-def $exec42    $sgpr2_sgpr3 = S_AND_B64 killed renamable $sgpr2_sgpr3, killed renamable $sgpr0_sgpr1, implicit-def dead $scc43    $exec = S_MOV_B64_term killed renamable $sgpr2_sgpr344...45 46---47 48# Check if the modifiers are preserved when generating the V_CMPX instruction.49 50# GCN-LABEL: name: vcmp_saveexec_to_mov_vcmpx_check_abs51# GFX1010: V_CMP_LT_F32_e6452# GFX1010: S_AND_SAVEEXEC_B6453# GFX1030: S_MOV_B6454# GFX1030-NEXT: V_CMPX_LT_F32_nosdst_e64 0, 953267991, 255name: vcmp_saveexec_to_mov_vcmpx_check_abs56tracksRegLiveness: true57body: |58  bb.0:59    liveins: $vgpr060    renamable $sgpr0_sgpr1 = V_CMP_LT_F32_e64 0, 953267991, 2, $vgpr0, 0, implicit $mode, implicit $exec61    $sgpr2_sgpr3 = COPY $exec, implicit-def $exec62    $sgpr2_sgpr3 = S_AND_B64 killed renamable $sgpr2_sgpr3, killed renamable $sgpr0_sgpr1, implicit-def dead $scc63    $exec = S_MOV_B64_term killed renamable $sgpr2_sgpr364...65 66---67 68# Check if the sequence will be optimized even with more than 5 (unrelated) instructions inbetween the v_cmp and s_and_saveexec.69 70# GCN-LABEL: name: vcmp_saveexec_to_mov_vcmpx_check_many_instrs71# GFX1010: V_CMP_LT_F32_e6472# GFX1010: S_AND_SAVEEXEC_B6473# GFX1030: S_MOV_B6474# GFX1030: V_CMPX_LT_F32_nosdst_e64 0, 953267991, 275name: vcmp_saveexec_to_mov_vcmpx_check_many_instrs76tracksRegLiveness: true77body: |78  bb.0:79    liveins: $vgpr0, $sgpr2, $vgpr180    renamable $sgpr0_sgpr1 = V_CMP_LT_F32_e64 0, 953267991, 2, $vgpr0, 0, implicit $mode, implicit $exec81    $vgpr1 = V_WRITELANE_B32 0, $sgpr2, $vgpr182    $vgpr1 = V_WRITELANE_B32 0, $sgpr2, $vgpr183    $vgpr1 = V_WRITELANE_B32 0, $sgpr2, $vgpr184    $vgpr1 = V_WRITELANE_B32 0, $sgpr2, $vgpr185    $vgpr1 = V_WRITELANE_B32 0, $sgpr2, $vgpr186    $vgpr1 = V_WRITELANE_B32 0, $sgpr2, $vgpr187    $sgpr2_sgpr3 = COPY $exec, implicit-def $exec88    $sgpr2_sgpr3 = S_AND_B64 killed renamable $sgpr2_sgpr3, killed renamable $sgpr0_sgpr1, implicit-def dead $scc89    $exec = S_MOV_B64_term killed renamable $sgpr2_sgpr390