|
485 | 485 | (STP [16] dst (Select0 <typ.UInt64> (LDP [16] src mem)) (Select1 <typ.UInt64> (LDP [16] src mem)) |
486 | 486 | (STP dst (Select0 <typ.UInt64> (LDP src mem)) (Select1 <typ.UInt64> (LDP src mem)) mem)))) |
487 | 487 |
|
488 | | -(MOVDstorezero {s} [i] ptr x:(MOVDstorezero {s} [i+8] ptr mem)) && x.Uses == 1 && setPos(v, x.Pos) && clobber(x) => (MOVQstorezero {s} [i] ptr mem) |
489 | | -(MOVDstorezero {s} [i] ptr x:(MOVDstorezero {s} [i-8] ptr mem)) && x.Uses == 1 && setPos(v, x.Pos) && clobber(x) => (MOVQstorezero {s} [i-8] ptr mem) |
490 | | - |
491 | 488 | // strip off fractional word move |
492 | 489 | (Move [s] dst src mem) && s%16 != 0 && s%16 <= 8 && s > 16 => |
493 | 490 | (Move [8] |
|
817 | 814 | (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem) && is32Bit(int64(off1)+off2) |
818 | 815 | && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
819 | 816 | (FMOVDstore [off1+int32(off2)] {sym} ptr val mem) |
820 | | -(MOVBstorezero [off1] {sym} (ADDconst [off2] ptr) mem) && is32Bit(int64(off1)+off2) |
821 | | - && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
822 | | - (MOVBstorezero [off1+int32(off2)] {sym} ptr mem) |
823 | | -(MOVHstorezero [off1] {sym} (ADDconst [off2] ptr) mem) && is32Bit(int64(off1)+off2) |
824 | | - && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
825 | | - (MOVHstorezero [off1+int32(off2)] {sym} ptr mem) |
826 | | -(MOVWstorezero [off1] {sym} (ADDconst [off2] ptr) mem) && is32Bit(int64(off1)+off2) |
827 | | - && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
828 | | - (MOVWstorezero [off1+int32(off2)] {sym} ptr mem) |
829 | | -(MOVDstorezero [off1] {sym} (ADDconst [off2] ptr) mem) && is32Bit(int64(off1)+off2) |
830 | | - && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
831 | | - (MOVDstorezero [off1+int32(off2)] {sym} ptr mem) |
832 | | -(MOVQstorezero [off1] {sym} (ADDconst [off2] ptr) mem) && is32Bit(int64(off1)+off2) |
833 | | - && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
834 | | - (MOVQstorezero [off1+int32(off2)] {sym} ptr mem) |
835 | 817 |
|
836 | 818 | // register indexed store |
837 | 819 | (MOVDstore [off] {sym} (ADD ptr idx) val mem) && off == 0 && sym == nil => (MOVDstoreidx ptr idx val mem) |
|
947 | 929 | && canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) |
948 | 930 | && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
949 | 931 | (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem) |
950 | | -(MOVBstorezero [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem) |
951 | | - && canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) |
952 | | - && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
953 | | - (MOVBstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem) |
954 | | -(MOVHstorezero [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem) |
955 | | - && canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) |
956 | | - && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
957 | | - (MOVHstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem) |
958 | | -(MOVWstorezero [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem) |
959 | | - && canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) |
960 | | - && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
961 | | - (MOVWstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem) |
962 | | -(MOVDstorezero [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem) |
963 | | - && canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) |
964 | | - && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
965 | | - (MOVDstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem) |
966 | | -(MOVQstorezero [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem) |
967 | | - && canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) |
968 | | - && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink) => |
969 | | - (MOVQstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem) |
970 | | - |
971 | | -// store zero |
972 | | -(MOVBstore [off] {sym} ptr (MOVDconst [0]) mem) => (MOVBstorezero [off] {sym} ptr mem) |
973 | | -(MOVHstore [off] {sym} ptr (MOVDconst [0]) mem) => (MOVHstorezero [off] {sym} ptr mem) |
974 | | -(MOVWstore [off] {sym} ptr (MOVDconst [0]) mem) => (MOVWstorezero [off] {sym} ptr mem) |
975 | | -(MOVDstore [off] {sym} ptr (MOVDconst [0]) mem) => (MOVDstorezero [off] {sym} ptr mem) |
976 | | -(STP [off] {sym} ptr (MOVDconst [0]) (MOVDconst [0]) mem) => (MOVQstorezero [off] {sym} ptr mem) |
977 | | - |
978 | | -// register indexed store zero |
979 | | -(MOVDstorezero [off] {sym} (ADD ptr idx) mem) && off == 0 && sym == nil => (MOVDstorezeroidx ptr idx mem) |
980 | | -(MOVWstorezero [off] {sym} (ADD ptr idx) mem) && off == 0 && sym == nil => (MOVWstorezeroidx ptr idx mem) |
981 | | -(MOVHstorezero [off] {sym} (ADD ptr idx) mem) && off == 0 && sym == nil => (MOVHstorezeroidx ptr idx mem) |
982 | | -(MOVBstorezero [off] {sym} (ADD ptr idx) mem) && off == 0 && sym == nil => (MOVBstorezeroidx ptr idx mem) |
983 | | -(MOVDstoreidx ptr idx (MOVDconst [0]) mem) => (MOVDstorezeroidx ptr idx mem) |
984 | | -(MOVWstoreidx ptr idx (MOVDconst [0]) mem) => (MOVWstorezeroidx ptr idx mem) |
985 | | -(MOVHstoreidx ptr idx (MOVDconst [0]) mem) => (MOVHstorezeroidx ptr idx mem) |
986 | | -(MOVBstoreidx ptr idx (MOVDconst [0]) mem) => (MOVBstorezeroidx ptr idx mem) |
987 | | -(MOVDstorezeroidx ptr (MOVDconst [c]) mem) && is32Bit(c) => (MOVDstorezero [int32(c)] ptr mem) |
988 | | -(MOVDstorezeroidx (MOVDconst [c]) idx mem) && is32Bit(c) => (MOVDstorezero [int32(c)] idx mem) |
989 | | -(MOVWstorezeroidx ptr (MOVDconst [c]) mem) && is32Bit(c) => (MOVWstorezero [int32(c)] ptr mem) |
990 | | -(MOVWstorezeroidx (MOVDconst [c]) idx mem) && is32Bit(c) => (MOVWstorezero [int32(c)] idx mem) |
991 | | -(MOVHstorezeroidx ptr (MOVDconst [c]) mem) && is32Bit(c) => (MOVHstorezero [int32(c)] ptr mem) |
992 | | -(MOVHstorezeroidx (MOVDconst [c]) idx mem) && is32Bit(c) => (MOVHstorezero [int32(c)] idx mem) |
993 | | -(MOVBstorezeroidx ptr (MOVDconst [c]) mem) && is32Bit(c) => (MOVBstorezero [int32(c)] ptr mem) |
994 | | -(MOVBstorezeroidx (MOVDconst [c]) idx mem) && is32Bit(c) => (MOVBstorezero [int32(c)] idx mem) |
995 | | - |
996 | | -// shifted register indexed store zero |
997 | | -(MOVDstorezero [off] {sym} (ADDshiftLL [3] ptr idx) mem) && off == 0 && sym == nil => (MOVDstorezeroidx8 ptr idx mem) |
998 | | -(MOVWstorezero [off] {sym} (ADDshiftLL [2] ptr idx) mem) && off == 0 && sym == nil => (MOVWstorezeroidx4 ptr idx mem) |
999 | | -(MOVHstorezero [off] {sym} (ADDshiftLL [1] ptr idx) mem) && off == 0 && sym == nil => (MOVHstorezeroidx2 ptr idx mem) |
1000 | | -(MOVDstorezeroidx ptr (SLLconst [3] idx) mem) => (MOVDstorezeroidx8 ptr idx mem) |
1001 | | -(MOVWstorezeroidx ptr (SLLconst [2] idx) mem) => (MOVWstorezeroidx4 ptr idx mem) |
1002 | | -(MOVHstorezeroidx ptr (SLLconst [1] idx) mem) => (MOVHstorezeroidx2 ptr idx mem) |
1003 | | -(MOVHstorezeroidx ptr (ADD idx idx) mem) => (MOVHstorezeroidx2 ptr idx mem) |
1004 | | -(MOVDstorezeroidx (SLLconst [3] idx) ptr mem) => (MOVDstorezeroidx8 ptr idx mem) |
1005 | | -(MOVWstorezeroidx (SLLconst [2] idx) ptr mem) => (MOVWstorezeroidx4 ptr idx mem) |
1006 | | -(MOVHstorezeroidx (SLLconst [1] idx) ptr mem) => (MOVHstorezeroidx2 ptr idx mem) |
1007 | | -(MOVHstorezeroidx (ADD idx idx) ptr mem) => (MOVHstorezeroidx2 ptr idx mem) |
1008 | | -(MOVDstoreidx8 ptr idx (MOVDconst [0]) mem) => (MOVDstorezeroidx8 ptr idx mem) |
1009 | | -(MOVWstoreidx4 ptr idx (MOVDconst [0]) mem) => (MOVWstorezeroidx4 ptr idx mem) |
1010 | | -(MOVHstoreidx2 ptr idx (MOVDconst [0]) mem) => (MOVHstorezeroidx2 ptr idx mem) |
1011 | | -(MOVDstorezeroidx8 ptr (MOVDconst [c]) mem) && is32Bit(c<<3) => (MOVDstorezero [int32(c<<3)] ptr mem) |
1012 | | -(MOVWstorezeroidx4 ptr (MOVDconst [c]) mem) && is32Bit(c<<2) => (MOVWstorezero [int32(c<<2)] ptr mem) |
1013 | | -(MOVHstorezeroidx2 ptr (MOVDconst [c]) mem) && is32Bit(c<<1) => (MOVHstorezero [int32(c<<1)] ptr mem) |
1014 | 932 |
|
1015 | 933 | // replace load from same location as preceding store with zero/sign extension (or copy in case of full width) |
1016 | 934 | // these seem to have bad interaction with other rules, resulting in slower code |
|
1025 | 943 | //(FMOVDload [off] {sym} ptr (FMOVDstore [off2] {sym2} ptr2 x _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) -> x |
1026 | 944 | //(LDP [off] {sym} ptr (STP [off2] {sym2} ptr2 x y _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) -> x y |
1027 | 945 |
|
1028 | | -(MOVBload [off] {sym} ptr (MOVBstorezero [off2] {sym2} ptr2 _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) => (MOVDconst [0]) |
1029 | | -(MOVBUload [off] {sym} ptr (MOVBstorezero [off2] {sym2} ptr2 _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) => (MOVDconst [0]) |
1030 | | -(MOVHload [off] {sym} ptr (MOVHstorezero [off2] {sym2} ptr2 _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) => (MOVDconst [0]) |
1031 | | -(MOVHUload [off] {sym} ptr (MOVHstorezero [off2] {sym2} ptr2 _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) => (MOVDconst [0]) |
1032 | | -(MOVWload [off] {sym} ptr (MOVWstorezero [off2] {sym2} ptr2 _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) => (MOVDconst [0]) |
1033 | | -(MOVWUload [off] {sym} ptr (MOVWstorezero [off2] {sym2} ptr2 _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) => (MOVDconst [0]) |
1034 | | -(MOVDload [off] {sym} ptr (MOVDstorezero [off2] {sym2} ptr2 _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) => (MOVDconst [0]) |
1035 | | - |
1036 | | -(MOVBloadidx ptr idx (MOVBstorezeroidx ptr2 idx2 _)) |
1037 | | - && (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) => (MOVDconst [0]) |
1038 | | -(MOVBUloadidx ptr idx (MOVBstorezeroidx ptr2 idx2 _)) |
1039 | | - && (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) => (MOVDconst [0]) |
1040 | | -(MOVHloadidx ptr idx (MOVHstorezeroidx ptr2 idx2 _)) |
1041 | | - && (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) => (MOVDconst [0]) |
1042 | | -(MOVHUloadidx ptr idx (MOVHstorezeroidx ptr2 idx2 _)) |
1043 | | - && (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) => (MOVDconst [0]) |
1044 | | -(MOVWloadidx ptr idx (MOVWstorezeroidx ptr2 idx2 _)) |
1045 | | - && (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) => (MOVDconst [0]) |
1046 | | -(MOVWUloadidx ptr idx (MOVWstorezeroidx ptr2 idx2 _)) |
1047 | | - && (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) => (MOVDconst [0]) |
1048 | | -(MOVDloadidx ptr idx (MOVDstorezeroidx ptr2 idx2 _)) |
1049 | | - && (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) => (MOVDconst [0]) |
1050 | | - |
1051 | | -(MOVHloadidx2 ptr idx (MOVHstorezeroidx2 ptr2 idx2 _)) && isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) => (MOVDconst [0]) |
1052 | | -(MOVHUloadidx2 ptr idx (MOVHstorezeroidx2 ptr2 idx2 _)) && isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) => (MOVDconst [0]) |
1053 | | -(MOVWloadidx4 ptr idx (MOVWstorezeroidx4 ptr2 idx2 _)) && isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) => (MOVDconst [0]) |
1054 | | -(MOVWUloadidx4 ptr idx (MOVWstorezeroidx4 ptr2 idx2 _)) && isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) => (MOVDconst [0]) |
1055 | | -(MOVDloadidx8 ptr idx (MOVDstorezeroidx8 ptr2 idx2 _)) && isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) => (MOVDconst [0]) |
1056 | | - |
1057 | 946 | // don't extend before store |
1058 | 947 | (MOVBstore [off] {sym} ptr (MOVBreg x) mem) => (MOVBstore [off] {sym} ptr x mem) |
1059 | 948 | (MOVBstore [off] {sym} ptr (MOVBUreg x) mem) => (MOVBstore [off] {sym} ptr x mem) |
|
0 commit comments