diff options
| author | Mike Pall <mike> | 2012-07-02 22:37:00 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2012-07-02 22:37:00 +0200 |
| commit | 264177b0d041fdea5e07091a0c585607e9b55828 (patch) | |
| tree | 41b95d0c63a81b4f2a0719b014d6fdd640c82d5e | |
| parent | 7ae3832f2048edaa14c0050326aaa3ce2273975f (diff) | |
| download | luajit-264177b0d041fdea5e07091a0c585607e9b55828.tar.gz luajit-264177b0d041fdea5e07091a0c585607e9b55828.tar.bz2 luajit-264177b0d041fdea5e07091a0c585607e9b55828.zip | |
Use HIOP for XSTORE in SPLIT pass.
| -rw-r--r-- | src/lj_asm_arm.h | 44 | ||||
| -rw-r--r-- | src/lj_asm_mips.h | 38 | ||||
| -rw-r--r-- | src/lj_asm_ppc.h | 25 | ||||
| -rw-r--r-- | src/lj_asm_x86.h | 10 | ||||
| -rw-r--r-- | src/lj_opt_split.c | 22 |
5 files changed, 77 insertions, 62 deletions
diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h index 5ec3d59f..c08b6196 100644 --- a/src/lj_asm_arm.h +++ b/src/lj_asm_arm.h | |||
| @@ -206,17 +206,19 @@ static IRRef asm_fuselsl2(ASMState *as, IRRef ref) | |||
| 206 | 206 | ||
| 207 | /* Fuse XLOAD/XSTORE reference into load/store operand. */ | 207 | /* Fuse XLOAD/XSTORE reference into load/store operand. */ |
| 208 | static void asm_fusexref(ASMState *as, ARMIns ai, Reg rd, IRRef ref, | 208 | static void asm_fusexref(ASMState *as, ARMIns ai, Reg rd, IRRef ref, |
| 209 | RegSet allow) | 209 | RegSet allow, int32_t ofs) |
| 210 | { | 210 | { |
| 211 | IRIns *ir = IR(ref); | 211 | IRIns *ir = IR(ref); |
| 212 | int32_t ofs = 0; | ||
| 213 | Reg base; | 212 | Reg base; |
| 214 | if (ra_noreg(ir->r) && mayfuse(as, ref)) { | 213 | if (ra_noreg(ir->r) && mayfuse(as, ref)) { |
| 215 | int32_t lim = (ai & 0x04000000) ? 4096 : 256; | 214 | int32_t lim = (ai & 0x04000000) ? 4096 : 256; |
| 216 | if (ir->o == IR_ADD) { | 215 | if (ir->o == IR_ADD) { |
| 217 | if (irref_isk(ir->op2) && (ofs = IR(ir->op2)->i) > -lim && ofs < lim) { | 216 | int32_t ofs2; |
| 217 | if (irref_isk(ir->op2) && | ||
| 218 | (ofs2 = ofs + IR(ir->op2)->i) > -lim && ofs2 < lim) { | ||
| 219 | ofs = ofs2; | ||
| 218 | ref = ir->op1; | 220 | ref = ir->op1; |
| 219 | } else { | 221 | } else if (ofs == 0) { |
| 220 | IRRef lref = ir->op1, rref = ir->op2; | 222 | IRRef lref = ir->op1, rref = ir->op2; |
| 221 | Reg rn, rm; | 223 | Reg rn, rm; |
| 222 | if ((ai & 0x04000000)) { | 224 | if ((ai & 0x04000000)) { |
| @@ -237,6 +239,7 @@ static void asm_fusexref(ASMState *as, ARMIns ai, Reg rd, IRRef ref, | |||
| 237 | return; | 239 | return; |
| 238 | } | 240 | } |
| 239 | } else if (ir->o == IR_STRREF) { | 241 | } else if (ir->o == IR_STRREF) { |
| 242 | lua_assert(ofs == 0); | ||
| 240 | ofs = (int32_t)sizeof(GCstr); | 243 | ofs = (int32_t)sizeof(GCstr); |
| 241 | if (irref_isk(ir->op2)) { | 244 | if (irref_isk(ir->op2)) { |
| 242 | ofs += IR(ir->op2)->i; | 245 | ofs += IR(ir->op2)->i; |
| @@ -809,29 +812,33 @@ static void asm_fload(ASMState *as, IRIns *ir) | |||
| 809 | 812 | ||
| 810 | static void asm_fstore(ASMState *as, IRIns *ir) | 813 | static void asm_fstore(ASMState *as, IRIns *ir) |
| 811 | { | 814 | { |
| 812 | Reg src = ra_alloc1(as, ir->op2, RSET_GPR); | 815 | if (ir->r == RID_SINK) { /* Sink store. */ |
| 813 | IRIns *irf = IR(ir->op1); | 816 | asm_snap_prep(as); |
| 814 | Reg idx = ra_alloc1(as, irf->op1, rset_exclude(RSET_GPR, src)); | 817 | } else { |
| 815 | int32_t ofs = field_ofs[irf->op2]; | 818 | Reg src = ra_alloc1(as, ir->op2, RSET_GPR); |
| 816 | ARMIns ai = asm_fxstoreins(ir); | 819 | IRIns *irf = IR(ir->op1); |
| 817 | if ((ai & 0x04000000)) | 820 | Reg idx = ra_alloc1(as, irf->op1, rset_exclude(RSET_GPR, src)); |
| 818 | emit_lso(as, ai, src, idx, ofs); | 821 | int32_t ofs = field_ofs[irf->op2]; |
| 819 | else | 822 | ARMIns ai = asm_fxstoreins(ir); |
| 820 | emit_lsox(as, ai, src, idx, ofs); | 823 | if ((ai & 0x04000000)) |
| 824 | emit_lso(as, ai, src, idx, ofs); | ||
| 825 | else | ||
| 826 | emit_lsox(as, ai, src, idx, ofs); | ||
| 827 | } | ||
| 821 | } | 828 | } |
| 822 | 829 | ||
| 823 | static void asm_xload(ASMState *as, IRIns *ir) | 830 | static void asm_xload(ASMState *as, IRIns *ir) |
| 824 | { | 831 | { |
| 825 | Reg dest = ra_dest(as, ir, RSET_GPR); | 832 | Reg dest = ra_dest(as, ir, RSET_GPR); |
| 826 | lua_assert(!(ir->op2 & IRXLOAD_UNALIGNED)); | 833 | lua_assert(!(ir->op2 & IRXLOAD_UNALIGNED)); |
| 827 | asm_fusexref(as, asm_fxloadins(ir), dest, ir->op1, RSET_GPR); | 834 | asm_fusexref(as, asm_fxloadins(ir), dest, ir->op1, RSET_GPR, 0); |
| 828 | } | 835 | } |
| 829 | 836 | ||
| 830 | static void asm_xstore(ASMState *as, IRIns *ir) | 837 | static void asm_xstore(ASMState *as, IRIns *ir, int32_t ofs) |
| 831 | { | 838 | { |
| 832 | Reg src = ra_alloc1(as, ir->op2, RSET_GPR); | 839 | Reg src = ra_alloc1(as, ir->op2, RSET_GPR); |
| 833 | asm_fusexref(as, asm_fxstoreins(ir), src, ir->op1, | 840 | asm_fusexref(as, asm_fxstoreins(ir), src, ir->op1, |
| 834 | rset_exclude(RSET_GPR, src)); | 841 | rset_exclude(RSET_GPR, src), ofs); |
| 835 | } | 842 | } |
| 836 | 843 | ||
| 837 | static void asm_ahuvload(ASMState *as, IRIns *ir) | 844 | static void asm_ahuvload(ASMState *as, IRIns *ir) |
| @@ -1374,6 +1381,9 @@ static void asm_hiop(ASMState *as, IRIns *ir) | |||
| 1374 | if (uselo || usehi) | 1381 | if (uselo || usehi) |
| 1375 | asm_fpmin_max(as, ir-1, (ir-1)->o == IR_MIN ? CC_HI : CC_LO); | 1382 | asm_fpmin_max(as, ir-1, (ir-1)->o == IR_MIN ? CC_HI : CC_LO); |
| 1376 | return; | 1383 | return; |
| 1384 | } else if ((ir-1)->o == IR_XSTORE) { | ||
| 1385 | asm_xstore(as, ir, 4); | ||
| 1386 | return; | ||
| 1377 | } | 1387 | } |
| 1378 | if (!usehi) return; /* Skip unused hiword op for all remaining ops. */ | 1388 | if (!usehi) return; /* Skip unused hiword op for all remaining ops. */ |
| 1379 | switch ((ir-1)->o) { | 1389 | switch ((ir-1)->o) { |
| @@ -1702,7 +1712,7 @@ static void asm_ir(ASMState *as, IRIns *ir) | |||
| 1702 | 1712 | ||
| 1703 | case IR_ASTORE: case IR_HSTORE: case IR_USTORE: asm_ahustore(as, ir); break; | 1713 | case IR_ASTORE: case IR_HSTORE: case IR_USTORE: asm_ahustore(as, ir); break; |
| 1704 | case IR_FSTORE: asm_fstore(as, ir); break; | 1714 | case IR_FSTORE: asm_fstore(as, ir); break; |
| 1705 | case IR_XSTORE: asm_xstore(as, ir); break; | 1715 | case IR_XSTORE: asm_xstore(as, ir, 0); break; |
| 1706 | 1716 | ||
| 1707 | /* Allocations. */ | 1717 | /* Allocations. */ |
| 1708 | case IR_SNEW: case IR_XSNEW: asm_snew(as, ir); break; | 1718 | case IR_SNEW: case IR_XSNEW: asm_snew(as, ir); break; |
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h index 9bae4778..a3a4da6c 100644 --- a/src/lj_asm_mips.h +++ b/src/lj_asm_mips.h | |||
| @@ -183,20 +183,20 @@ static Reg asm_fuseahuref(ASMState *as, IRRef ref, int32_t *ofsp, RegSet allow) | |||
| 183 | 183 | ||
| 184 | /* Fuse XLOAD/XSTORE reference into load/store operand. */ | 184 | /* Fuse XLOAD/XSTORE reference into load/store operand. */ |
| 185 | static void asm_fusexref(ASMState *as, MIPSIns mi, Reg rt, IRRef ref, | 185 | static void asm_fusexref(ASMState *as, MIPSIns mi, Reg rt, IRRef ref, |
| 186 | RegSet allow) | 186 | RegSet allow, int32_t ofs) |
| 187 | { | 187 | { |
| 188 | IRIns *ir = IR(ref); | 188 | IRIns *ir = IR(ref); |
| 189 | int32_t ofs = 0; | ||
| 190 | Reg base; | 189 | Reg base; |
| 191 | if (ra_noreg(ir->r) && mayfuse(as, ref)) { | 190 | if (ra_noreg(ir->r) && mayfuse(as, ref)) { |
| 192 | if (ir->o == IR_ADD) { | 191 | if (ir->o == IR_ADD) { |
| 193 | int32_t ofs2; | 192 | int32_t ofs2; |
| 194 | if (irref_isk(ir->op2) && (ofs2 = IR(ir->op2)->i, checki16(ofs2))) { | 193 | if (irref_isk(ir->op2) && (ofs2 = ofs + IR(ir->op2)->i, checki16(ofs2))) { |
| 195 | ref = ir->op1; | 194 | ref = ir->op1; |
| 196 | ofs = ofs2; | 195 | ofs = ofs2; |
| 197 | } | 196 | } |
| 198 | } else if (ir->o == IR_STRREF) { | 197 | } else if (ir->o == IR_STRREF) { |
| 199 | int32_t ofs2 = 65536; | 198 | int32_t ofs2 = 65536; |
| 199 | lua_assert(ofs == 0); | ||
| 200 | ofs = (int32_t)sizeof(GCstr); | 200 | ofs = (int32_t)sizeof(GCstr); |
| 201 | if (irref_isk(ir->op2)) { | 201 | if (irref_isk(ir->op2)) { |
| 202 | ofs2 = ofs + IR(ir->op2)->i; | 202 | ofs2 = ofs + IR(ir->op2)->i; |
| @@ -889,27 +889,32 @@ static void asm_fload(ASMState *as, IRIns *ir) | |||
| 889 | 889 | ||
| 890 | static void asm_fstore(ASMState *as, IRIns *ir) | 890 | static void asm_fstore(ASMState *as, IRIns *ir) |
| 891 | { | 891 | { |
| 892 | Reg src = ra_alloc1z(as, ir->op2, RSET_GPR); | 892 | if (ir->r == RID_SINK) { /* Sink store. */ |
| 893 | IRIns *irf = IR(ir->op1); | 893 | asm_snap_prep(as); |
| 894 | Reg idx = ra_alloc1(as, irf->op1, rset_exclude(RSET_GPR, src)); | 894 | return; |
| 895 | int32_t ofs = field_ofs[irf->op2]; | 895 | } else { |
| 896 | MIPSIns mi = asm_fxstoreins(ir); | 896 | Reg src = ra_alloc1z(as, ir->op2, RSET_GPR); |
| 897 | lua_assert(!irt_isfp(ir->t)); | 897 | IRIns *irf = IR(ir->op1); |
| 898 | emit_tsi(as, mi, src, idx, ofs); | 898 | Reg idx = ra_alloc1(as, irf->op1, rset_exclude(RSET_GPR, src)); |
| 899 | int32_t ofs = field_ofs[irf->op2]; | ||
| 900 | MIPSIns mi = asm_fxstoreins(ir); | ||
| 901 | lua_assert(!irt_isfp(ir->t)); | ||
| 902 | emit_tsi(as, mi, src, idx, ofs); | ||
| 903 | } | ||
| 899 | } | 904 | } |
| 900 | 905 | ||
| 901 | static void asm_xload(ASMState *as, IRIns *ir) | 906 | static void asm_xload(ASMState *as, IRIns *ir) |
| 902 | { | 907 | { |
| 903 | Reg dest = ra_dest(as, ir, irt_isfp(ir->t) ? RSET_FPR : RSET_GPR); | 908 | Reg dest = ra_dest(as, ir, irt_isfp(ir->t) ? RSET_FPR : RSET_GPR); |
| 904 | lua_assert(!(ir->op2 & IRXLOAD_UNALIGNED)); | 909 | lua_assert(!(ir->op2 & IRXLOAD_UNALIGNED)); |
| 905 | asm_fusexref(as, asm_fxloadins(ir), dest, ir->op1, RSET_GPR); | 910 | asm_fusexref(as, asm_fxloadins(ir), dest, ir->op1, RSET_GPR, 0); |
| 906 | } | 911 | } |
| 907 | 912 | ||
| 908 | static void asm_xstore(ASMState *as, IRIns *ir) | 913 | static void asm_xstore(ASMState *as, IRIns *ir, int32_t ofs) |
| 909 | { | 914 | { |
| 910 | Reg src = ra_alloc1z(as, ir->op2, irt_isfp(ir->t) ? RSET_FPR : RSET_GPR); | 915 | Reg src = ra_alloc1z(as, ir->op2, irt_isfp(ir->t) ? RSET_FPR : RSET_GPR); |
| 911 | asm_fusexref(as, asm_fxstoreins(ir), src, ir->op1, | 916 | asm_fusexref(as, asm_fxstoreins(ir), src, ir->op1, |
| 912 | rset_exclude(RSET_GPR, src)); | 917 | rset_exclude(RSET_GPR, src), ofs); |
| 913 | } | 918 | } |
| 914 | 919 | ||
| 915 | static void asm_ahuvload(ASMState *as, IRIns *ir) | 920 | static void asm_ahuvload(ASMState *as, IRIns *ir) |
| @@ -1554,6 +1559,11 @@ static void asm_hiop(ASMState *as, IRIns *ir) | |||
| 1554 | as->curins--; /* Always skip the loword comparison. */ | 1559 | as->curins--; /* Always skip the loword comparison. */ |
| 1555 | asm_comp64eq(as, ir); | 1560 | asm_comp64eq(as, ir); |
| 1556 | return; | 1561 | return; |
| 1562 | } else if ((ir-1)->o == IR_XSTORE) { | ||
| 1563 | as->curins--; /* Handle both stores here. */ | ||
| 1564 | asm_xstore(as, ir, LJ_LE ? 4 : 0); | ||
| 1565 | asm_xstore(as, ir-1, LJ_LE ? 0 : 4); | ||
| 1566 | return; | ||
| 1557 | } | 1567 | } |
| 1558 | if (!usehi) return; /* Skip unused hiword op for all remaining ops. */ | 1568 | if (!usehi) return; /* Skip unused hiword op for all remaining ops. */ |
| 1559 | switch ((ir-1)->o) { | 1569 | switch ((ir-1)->o) { |
| @@ -1832,7 +1842,7 @@ static void asm_ir(ASMState *as, IRIns *ir) | |||
| 1832 | 1842 | ||
| 1833 | case IR_ASTORE: case IR_HSTORE: case IR_USTORE: asm_ahustore(as, ir); break; | 1843 | case IR_ASTORE: case IR_HSTORE: case IR_USTORE: asm_ahustore(as, ir); break; |
| 1834 | case IR_FSTORE: asm_fstore(as, ir); break; | 1844 | case IR_FSTORE: asm_fstore(as, ir); break; |
| 1835 | case IR_XSTORE: asm_xstore(as, ir); break; | 1845 | case IR_XSTORE: asm_xstore(as, ir, 0); break; |
| 1836 | 1846 | ||
| 1837 | /* Allocations. */ | 1847 | /* Allocations. */ |
| 1838 | case IR_SNEW: case IR_XSNEW: asm_snew(as, ir); break; | 1848 | case IR_SNEW: case IR_XSNEW: asm_snew(as, ir); break; |
diff --git a/src/lj_asm_ppc.h b/src/lj_asm_ppc.h index 73942b8b..ec22e260 100644 --- a/src/lj_asm_ppc.h +++ b/src/lj_asm_ppc.h | |||
| @@ -162,22 +162,24 @@ static Reg asm_fuseahuref(ASMState *as, IRRef ref, int32_t *ofsp, RegSet allow) | |||
| 162 | 162 | ||
| 163 | /* Fuse XLOAD/XSTORE reference into load/store operand. */ | 163 | /* Fuse XLOAD/XSTORE reference into load/store operand. */ |
| 164 | static void asm_fusexref(ASMState *as, PPCIns pi, Reg rt, IRRef ref, | 164 | static void asm_fusexref(ASMState *as, PPCIns pi, Reg rt, IRRef ref, |
| 165 | RegSet allow) | 165 | RegSet allow, int32_t ofs) |
| 166 | { | 166 | { |
| 167 | IRIns *ir = IR(ref); | 167 | IRIns *ir = IR(ref); |
| 168 | int32_t ofs = 0; | ||
| 169 | Reg base; | 168 | Reg base; |
| 170 | if (ra_noreg(ir->r) && mayfuse(as, ref)) { | 169 | if (ra_noreg(ir->r) && mayfuse(as, ref)) { |
| 171 | if (ir->o == IR_ADD) { | 170 | if (ir->o == IR_ADD) { |
| 172 | if (irref_isk(ir->op2) && (ofs = IR(ir->op2)->i, checki16(ofs))) { | 171 | int32_t ofs2; |
| 172 | if (irref_isk(ir->op2) && (ofs2 = ofs + IR(ir->op2)->i, checki16(ofs2))) { | ||
| 173 | ofs = ofs2; | ||
| 173 | ref = ir->op1; | 174 | ref = ir->op1; |
| 174 | } else { | 175 | } else if (ofs == 0) { |
| 175 | Reg right, left = ra_alloc2(as, ir, allow); | 176 | Reg right, left = ra_alloc2(as, ir, allow); |
| 176 | right = (left >> 8); left &= 255; | 177 | right = (left >> 8); left &= 255; |
| 177 | emit_fab(as, PPCI_LWZX | ((pi >> 20) & 0x780), rt, left, right); | 178 | emit_fab(as, PPCI_LWZX | ((pi >> 20) & 0x780), rt, left, right); |
| 178 | return; | 179 | return; |
| 179 | } | 180 | } |
| 180 | } else if (ir->o == IR_STRREF) { | 181 | } else if (ir->o == IR_STRREF) { |
| 182 | lua_assert(ofs == 0); | ||
| 181 | ofs = (int32_t)sizeof(GCstr); | 183 | ofs = (int32_t)sizeof(GCstr); |
| 182 | if (irref_isk(ir->op2)) { | 184 | if (irref_isk(ir->op2)) { |
| 183 | ofs += IR(ir->op2)->i; | 185 | ofs += IR(ir->op2)->i; |
| @@ -904,13 +906,13 @@ static void asm_xload(ASMState *as, IRIns *ir) | |||
| 904 | lua_assert(!(ir->op2 & IRXLOAD_UNALIGNED)); | 906 | lua_assert(!(ir->op2 & IRXLOAD_UNALIGNED)); |
| 905 | if (irt_isi8(ir->t)) | 907 | if (irt_isi8(ir->t)) |
| 906 | emit_as(as, PPCI_EXTSB, dest, dest); | 908 | emit_as(as, PPCI_EXTSB, dest, dest); |
| 907 | asm_fusexref(as, asm_fxloadins(ir), dest, ir->op1, RSET_GPR); | 909 | asm_fusexref(as, asm_fxloadins(ir), dest, ir->op1, RSET_GPR, 0); |
| 908 | } | 910 | } |
| 909 | 911 | ||
| 910 | static void asm_xstore(ASMState *as, IRIns *ir) | 912 | static void asm_xstore(ASMState *as, IRIns *ir, int32_t ofs) |
| 911 | { | 913 | { |
| 912 | IRIns *irb; | 914 | IRIns *irb; |
| 913 | if (mayfuse(as, ir->op2) && (irb = IR(ir->op2))->o == IR_BSWAP && | 915 | if (ofs == 0 && mayfuse(as, ir->op2) && (irb = IR(ir->op2))->o == IR_BSWAP && |
| 914 | ra_noreg(irb->r) && (irt_isint(ir->t) || irt_isu32(ir->t))) { | 916 | ra_noreg(irb->r) && (irt_isint(ir->t) || irt_isu32(ir->t))) { |
| 915 | /* Fuse BSWAP with XSTORE to stwbrx. */ | 917 | /* Fuse BSWAP with XSTORE to stwbrx. */ |
| 916 | Reg src = ra_alloc1(as, irb->op1, RSET_GPR); | 918 | Reg src = ra_alloc1(as, irb->op1, RSET_GPR); |
| @@ -918,7 +920,7 @@ static void asm_xstore(ASMState *as, IRIns *ir) | |||
| 918 | } else { | 920 | } else { |
| 919 | Reg src = ra_alloc1(as, ir->op2, irt_isfp(ir->t) ? RSET_FPR : RSET_GPR); | 921 | Reg src = ra_alloc1(as, ir->op2, irt_isfp(ir->t) ? RSET_FPR : RSET_GPR); |
| 920 | asm_fusexref(as, asm_fxstoreins(ir), src, ir->op1, | 922 | asm_fusexref(as, asm_fxstoreins(ir), src, ir->op1, |
| 921 | rset_exclude(RSET_GPR, src)); | 923 | rset_exclude(RSET_GPR, src), ofs); |
| 922 | } | 924 | } |
| 923 | } | 925 | } |
| 924 | 926 | ||
| @@ -1743,6 +1745,11 @@ static void asm_hiop(ASMState *as, IRIns *ir) | |||
| 1743 | as->curins--; /* Always skip the loword comparison. */ | 1745 | as->curins--; /* Always skip the loword comparison. */ |
| 1744 | asm_comp64(as, ir); | 1746 | asm_comp64(as, ir); |
| 1745 | return; | 1747 | return; |
| 1748 | } else if ((ir-1)->o == IR_XSTORE) { | ||
| 1749 | as->curins--; /* Handle both stores here. */ | ||
| 1750 | asm_xstore(as, ir, 0); | ||
| 1751 | asm_xstore(as, ir-1, 4); | ||
| 1752 | return; | ||
| 1746 | } | 1753 | } |
| 1747 | if (!usehi) return; /* Skip unused hiword op for all remaining ops. */ | 1754 | if (!usehi) return; /* Skip unused hiword op for all remaining ops. */ |
| 1748 | switch ((ir-1)->o) { | 1755 | switch ((ir-1)->o) { |
| @@ -2035,7 +2042,7 @@ static void asm_ir(ASMState *as, IRIns *ir) | |||
| 2035 | 2042 | ||
| 2036 | case IR_ASTORE: case IR_HSTORE: case IR_USTORE: asm_ahustore(as, ir); break; | 2043 | case IR_ASTORE: case IR_HSTORE: case IR_USTORE: asm_ahustore(as, ir); break; |
| 2037 | case IR_FSTORE: asm_fstore(as, ir); break; | 2044 | case IR_FSTORE: asm_fstore(as, ir); break; |
| 2038 | case IR_XSTORE: asm_xstore(as, ir); break; | 2045 | case IR_XSTORE: asm_xstore(as, ir, 0); break; |
| 2039 | 2046 | ||
| 2040 | /* Allocations. */ | 2047 | /* Allocations. */ |
| 2041 | case IR_SNEW: case IR_XSNEW: asm_snew(as, ir); break; | 2048 | case IR_SNEW: case IR_XSNEW: asm_snew(as, ir); break; |
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h index c4ebdb1f..7647b03f 100644 --- a/src/lj_asm_x86.h +++ b/src/lj_asm_x86.h | |||
| @@ -1273,11 +1273,12 @@ static void asm_fxstore(ASMState *as, IRIns *ir) | |||
| 1273 | } | 1273 | } |
| 1274 | rset_clear(allow, src); | 1274 | rset_clear(allow, src); |
| 1275 | } | 1275 | } |
| 1276 | if (ir->o == IR_FSTORE) | 1276 | if (ir->o == IR_FSTORE) { |
| 1277 | asm_fusefref(as, IR(ir->op1), allow); | 1277 | asm_fusefref(as, IR(ir->op1), allow); |
| 1278 | else | 1278 | } else { |
| 1279 | asm_fusexref(as, ir->op1, allow); | 1279 | asm_fusexref(as, ir->op1, allow); |
| 1280 | /* ir->op2 is ignored -- unaligned stores are ok on x86. */ | 1280 | if (LJ_32 && ir->o == IR_HIOP) as->mrm.ofs += 4; |
| 1281 | } | ||
| 1281 | if (ra_hasreg(src)) { | 1282 | if (ra_hasreg(src)) { |
| 1282 | x86Op xo; | 1283 | x86Op xo; |
| 1283 | switch (irt_type(ir->t)) { | 1284 | switch (irt_type(ir->t)) { |
| @@ -2249,6 +2250,9 @@ static void asm_hiop(ASMState *as, IRIns *ir) | |||
| 2249 | } else if ((ir-1)->o <= IR_NE) { /* 64 bit integer comparisons. ORDER IR. */ | 2250 | } else if ((ir-1)->o <= IR_NE) { /* 64 bit integer comparisons. ORDER IR. */ |
| 2250 | asm_comp_int64(as, ir); | 2251 | asm_comp_int64(as, ir); |
| 2251 | return; | 2252 | return; |
| 2253 | } else if ((ir-1)->o == IR_XSTORE) { | ||
| 2254 | asm_fxstore(as, ir); | ||
| 2255 | return; | ||
| 2252 | } | 2256 | } |
| 2253 | if (!usehi) return; /* Skip unused hiword op for all remaining ops. */ | 2257 | if (!usehi) return; /* Skip unused hiword op for all remaining ops. */ |
| 2254 | switch ((ir-1)->o) { | 2258 | switch ((ir-1)->o) { |
diff --git a/src/lj_opt_split.c b/src/lj_opt_split.c index 72720e86..77b8e2dd 100644 --- a/src/lj_opt_split.c +++ b/src/lj_opt_split.c | |||
| @@ -78,8 +78,7 @@ | |||
| 78 | ** 0105 int HIOP 0103 +0 | 78 | ** 0105 int HIOP 0103 +0 |
| 79 | ** 0106 p32 ADD base +16 | 79 | ** 0106 p32 ADD base +16 |
| 80 | ** 0107 int XSTORE 0106 0104 | 80 | ** 0107 int XSTORE 0106 0104 |
| 81 | ** 0108 p32 ADD base +20 | 81 | ** 0108 int HIOP 0106 0105 |
| 82 | ** 0109 int XSTORE 0108 0105 | ||
| 83 | ** | 82 | ** |
| 84 | ** mov eax, [esi+0x8] | 83 | ** mov eax, [esi+0x8] |
| 85 | ** mov ecx, [esi+0xc] | 84 | ** mov ecx, [esi+0xc] |
| @@ -328,19 +327,9 @@ static void split_ir(jit_State *J) | |||
| 328 | #endif | 327 | #endif |
| 329 | break; | 328 | break; |
| 330 | } | 329 | } |
| 331 | case IR_ASTORE: case IR_HSTORE: case IR_USTORE: | 330 | case IR_ASTORE: case IR_HSTORE: case IR_USTORE: case IR_XSTORE: |
| 332 | split_emit(J, IRT(IR_HIOP, IRT_SOFTFP), nir->op1, hisubst[ir->op2]); | 331 | split_emit(J, IRT(IR_HIOP, IRT_SOFTFP), nir->op1, hisubst[ir->op2]); |
| 333 | break; | 332 | break; |
| 334 | case IR_XSTORE: { | ||
| 335 | #if LJ_LE | ||
| 336 | IRRef hiref = hisubst[ir->op2]; | ||
| 337 | #else | ||
| 338 | IRRef hiref = nir->op2; nir->op2 = hisubst[ir->op2]; | ||
| 339 | #endif | ||
| 340 | split_emit(J, IRT(IR_XSTORE, IRT_SOFTFP), | ||
| 341 | split_ptr(J, oir, ir->op1), hiref); | ||
| 342 | break; | ||
| 343 | } | ||
| 344 | case IR_CONV: { /* Conversion to number. Others handled below. */ | 333 | case IR_CONV: { /* Conversion to number. Others handled below. */ |
| 345 | IRType st = (IRType)(ir->op2 & IRCONV_SRCMASK); | 334 | IRType st = (IRType)(ir->op2 & IRCONV_SRCMASK); |
| 346 | UNUSED(st); | 335 | UNUSED(st); |
| @@ -434,12 +423,7 @@ static void split_ir(jit_State *J) | |||
| 434 | #endif | 423 | #endif |
| 435 | break; | 424 | break; |
| 436 | case IR_XSTORE: | 425 | case IR_XSTORE: |
| 437 | #if LJ_LE | 426 | split_emit(J, IRTI(IR_HIOP), nir->op1, hisubst[ir->op2]); |
| 438 | hiref = hisubst[ir->op2]; | ||
| 439 | #else | ||
| 440 | hiref = nir->op2; nir->op2 = hisubst[ir->op2]; | ||
| 441 | #endif | ||
| 442 | split_emit(J, IRTI(IR_XSTORE), split_ptr(J, oir, ir->op1), hiref); | ||
| 443 | break; | 427 | break; |
| 444 | case IR_CONV: { /* Conversion to 64 bit integer. Others handled below. */ | 428 | case IR_CONV: { /* Conversion to 64 bit integer. Others handled below. */ |
| 445 | IRType st = (IRType)(ir->op2 & IRCONV_SRCMASK); | 429 | IRType st = (IRType)(ir->op2 & IRCONV_SRCMASK); |
