Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td =================================================================== --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td @@ -943,7 +943,7 @@ [(set i64:$rD, (sextloadi32 xaddrX4:$src))]>, isPPC64, PPC970_DGroup_Cracked; // For fast-isel: -let isCodeGenOnly = 1, mayLoad = 1 in { +let isCodeGenOnly = 1, mayLoad = 1, hasSideEffects = 0 in { def LWA_32 : DSForm_1<58, 2, (outs gprc:$rD), (ins memrix:$src), "lwa $rD, $src", IIC_LdStLWA, []>, isPPC64, PPC970_DGroup_Cracked; Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td =================================================================== --- llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -2034,6 +2034,7 @@ } // Load Multiple +let mayLoad = 1, mayStore = 0, hasSideEffects = 0 in def LMW : DForm_1<46, (outs gprc:$rD), (ins memri:$src), "lmw $rD, $src", IIC_LdStLMW, []>; @@ -2188,6 +2189,7 @@ } // Store Multiple +let mayStore = 1, mayLoad = 0, hasSideEffects = 0 in def STMW : DForm_1<47, (outs), (ins gprc:$rS, memri:$dst), "stmw $rS, $dst", IIC_LdStLMW, []>; Index: llvm/lib/Target/PowerPC/PPCInstrVSX.td =================================================================== --- llvm/lib/Target/PowerPC/PPCInstrVSX.td +++ llvm/lib/Target/PowerPC/PPCInstrVSX.td @@ -1330,7 +1330,7 @@ [(set v4i32:$XT, (or v4i32:$XA, (vnot_ppc v4i32:$XB)))]>; // VSX scalar loads introduced in ISA 2.07 - let mayLoad = 1, mayStore = 0 in { + let mayLoad = 1, mayStore = 0, hasSideEffects = 0 in { let CodeSize = 3 in def LXSSPX : XX1Form_memOp<31, 524, (outs vssrc:$XT), (ins memrr:$src), "lxsspx $XT, $src", IIC_LdStLFD, []>; @@ -1355,7 +1355,7 @@ } // mayLoad // VSX scalar stores introduced in ISA 2.07 - let mayStore = 1, mayLoad = 0 in { + let mayStore = 1, mayLoad = 0, hasSideEffects = 0 in { let CodeSize = 3 in def STXSSPX : XX1Form_memOp<31, 652, (outs), (ins vssrc:$XT, memrr:$dst), "stxsspx $XT, $dst", IIC_LdStSTFD, []>; @@ -2927,7 +2927,7 @@ // When adding new D-Form loads/stores, be sure to update the ImmToIdxMap in // PPCRegisterInfo::PPCRegisterInfo and maybe save yourself some debugging. - let mayLoad = 1, mayStore = 0 in { + let mayLoad = 1, mayStore = 0, hasSideEffects = 0 in { // Load Vector def LXV : DQ_RD6_RS5_DQ12<61, 1, (outs vsrc:$XT), (ins memrix16:$src), "lxv $XT, $src", IIC_LdStLFD, []>; @@ -2972,7 +2972,7 @@ // When adding new D-Form loads/stores, be sure to update the ImmToIdxMap in // PPCRegisterInfo::PPCRegisterInfo and maybe save yourself some debugging. - let mayStore = 1, mayLoad = 0 in { + let mayStore = 1, mayLoad = 0, hasSideEffects = 0 in { // Store Vector def STXV : DQ_RD6_RS5_DQ12<61, 5, (outs), (ins vsrc:$XT, memrix16:$dst), "stxv $XT, $dst", IIC_LdStSTFD, []>; @@ -3710,7 +3710,7 @@ } } -let Predicates = [HasP9Vector] in { +let Predicates = [HasP9Vector], hasSideEffects = 0 in { let mayStore = 1 in { def SPILLTOVSR_STX : PseudoXFormMemOp<(outs), (ins spilltovsrrc:$XT, memrr:$dst), Index: llvm/test/CodeGen/PowerPC/extract-and-store.ll =================================================================== --- llvm/test/CodeGen/PowerPC/extract-and-store.ll +++ llvm/test/CodeGen/PowerPC/extract-and-store.ll @@ -794,8 +794,6 @@ ; ; CHECK-P9-LABEL: test_13_consecutive_stores_of_bytes: ; CHECK-P9: # %bb.0: # %entry -; CHECK-P9-NEXT: vsldoi v3, v2, v2, 4 -; CHECK-P9-NEXT: stxsibx vs35, 0, r5 ; CHECK-P9-NEXT: vsldoi v3, v2, v2, 12 ; CHECK-P9-NEXT: li r3, 1 ; CHECK-P9-NEXT: stxsibx vs35, r5, r3 @@ -808,6 +806,8 @@ ; CHECK-P9-NEXT: vsldoi v3, v2, v2, 2 ; CHECK-P9-NEXT: li r3, 4 ; CHECK-P9-NEXT: stxsibx vs35, r5, r3 +; CHECK-P9-NEXT: vsldoi v3, v2, v2, 4 +; CHECK-P9-NEXT: stxsibx vs35, 0, r5 ; CHECK-P9-NEXT: vsldoi v3, v2, v2, 8 ; CHECK-P9-NEXT: li r3, 5 ; CHECK-P9-NEXT: stxsibx vs35, r5, r3 @@ -836,19 +836,19 @@ ; ; CHECK-P9-BE-LABEL: test_13_consecutive_stores_of_bytes: ; CHECK-P9-BE: # %bb.0: # %entry -; CHECK-P9-BE-NEXT: vsldoi v3, v2, v2, 13 -; CHECK-P9-BE-NEXT: stxsibx vs35, 0, r5 +; CHECK-P9-BE-NEXT: li r3, 3 ; CHECK-P9-BE-NEXT: vsldoi v3, v2, v2, 5 +; CHECK-P9-BE-NEXT: stxsibx vs34, r5, r3 ; CHECK-P9-BE-NEXT: li r3, 1 ; CHECK-P9-BE-NEXT: stxsibx vs35, r5, r3 ; CHECK-P9-BE-NEXT: vsldoi v3, v2, v2, 2 ; CHECK-P9-BE-NEXT: li r3, 2 ; CHECK-P9-BE-NEXT: stxsibx vs35, r5, r3 -; CHECK-P9-BE-NEXT: li r3, 3 ; CHECK-P9-BE-NEXT: vsldoi v3, v2, v2, 15 -; CHECK-P9-BE-NEXT: stxsibx vs34, r5, r3 ; CHECK-P9-BE-NEXT: li r3, 4 ; CHECK-P9-BE-NEXT: stxsibx vs35, r5, r3 +; CHECK-P9-BE-NEXT: vsldoi v3, v2, v2, 13 +; CHECK-P9-BE-NEXT: stxsibx vs35, 0, r5 ; CHECK-P9-BE-NEXT: vsldoi v3, v2, v2, 9 ; CHECK-P9-BE-NEXT: li r3, 5 ; CHECK-P9-BE-NEXT: stxsibx vs35, r5, r3 Index: llvm/test/CodeGen/PowerPC/mi-scheduling.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/PowerPC/mi-scheduling.ll @@ -0,0 +1,42 @@ +; REQUIRES: asserts +; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -verify-misched -debug-only=machine-scheduler -o - 2>&1 > /dev/null | FileCheck %s + +; LXSD shouldn't have the sideeffects flag +@gd = external local_unnamed_addr global [500 x double], align 8 +@gf = external local_unnamed_addr global [500 x float], align 4 + +define double @sideeffects(double %a, double %b, double %c, double %d, double %e, double %f, double %g, double %h, double %i, double %j, double %k, double %l, double %m) { +entry: + %0 = load double, double* getelementptr inbounds ([500 x double], [500 x double]* @gd, i64 0, i64 10), align 8 + %1 = load double, double* getelementptr inbounds ([500 x double], [500 x double]* @gd, i64 0, i64 17), align 8 + %2 = load double, double* getelementptr inbounds ([500 x double], [500 x double]* @gd, i64 0, i64 87), align 8 + %3 = load double, double* getelementptr inbounds ([500 x double], [500 x double]* @gd, i64 0, i64 97), align 8 + %4 = load double, double* getelementptr inbounds ([500 x double], [500 x double]* @gd, i64 0, i64 77), align 8 + store double %3, double* getelementptr inbounds ([500 x double], [500 x double]* @gd, i64 0, i64 122), align 8 + %add = fadd double %a, %b + %add1 = fadd double %add, %c + %add2 = fadd double %add1, %d + %add3 = fadd double %add2, %e + %add4 = fadd double %add3, %f + %add5 = fadd double %add4, %g + %add6 = fadd double %add5, %h + %add7 = fadd double %add6, %i + %add8 = fadd double %add7, %j + %add9 = fadd double %add8, %k + %add10 = fadd double %add9, %l + %add11 = fadd double %add10, %m + %add12 = fadd double %add11, %0 + %add13 = fadd double %add12, %1 + %add14 = fadd double %add13, %2 + %add15 = fadd double %add14, %3 + %add16 = fadd double %add15, %4 + ret double %add16 +; CHECK: ********** MI Scheduling ********** +; CHECK-LABEL: sideeffects:%bb.0 entry +; CHECK-NOT:Global memory object and new barrier chain: SU({{[0-9]+}}). +; CHECK:SU({{[0-9]+}}): renamable $vf{{[0-9]+}} = LXSD 136 +; CHECK:SU({{[0-9]+}}): renamable $vf{{[0-9]+}} = LXSD 696 +; CHECK:SU({{[0-9]+}}): renamable $vf{{[0-9]+}} = LXSD 776 +; CHECK:SU({{[0-9]+}}): renamable $vf{{[0-9]+}} = LXSD 616 +; CHECK:SU({{[0-9]+}}): STXSD renamable $vf{{[0-9]+}}, 976 +}