diff options
| author | Cliff Click <cliffc@acm.org> | 2025-03-30 14:54:16 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2025-03-30 14:54:16 -0700 |
| commit | aea468c0b09891f89a8346de7bb37982f7767c2b (patch) | |
| tree | b219945aa7f51f615b8164901aaf2428be9611c6 /chapter21 | |
| parent | 150bbf6d1f71411c9cdffdc0081013a5dd0f4f4e (diff) | |
| download | Simple-aea468c0b09891f89a8346de7bb37982f7767c2b.tar.gz Simple-aea468c0b09891f89a8346de7bb37982f7767c2b.zip | |
Update x86_64_v2.java
Diffstat (limited to 'chapter21')
| -rw-r--r-- | chapter21/src/main/java/com/seaofnodes/simple/node/cpus/x86_64_v2/x86_64_v2.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/chapter21/src/main/java/com/seaofnodes/simple/node/cpus/x86_64_v2/x86_64_v2.java b/chapter21/src/main/java/com/seaofnodes/simple/node/cpus/x86_64_v2/x86_64_v2.java index d0056920..58f130a8 100644 --- a/chapter21/src/main/java/com/seaofnodes/simple/node/cpus/x86_64_v2/x86_64_v2.java +++ b/chapter21/src/main/java/com/seaofnodes/simple/node/cpus/x86_64_v2/x86_64_v2.java @@ -109,7 +109,7 @@ public class x86_64_v2 extends Machine { // assuming 64 bit by default so: 0100 1000 assert 0 <= reg && reg < 16; assert 0 <= ptr && ptr < 16; - assert 0 <= idx && idx < 16; + assert -1 <= idx && idx < 16; int rex = wide ? REX_W : REX; if( 8 <= reg && reg <= 15 ) rex |= 0b00000100; // REX.R @@ -534,7 +534,7 @@ public class x86_64_v2 extends Machine { return new CmpMemX86(bool, address(ld), ld.ptr(), idx, off, scale, imm(rhs), val, false); if( rhs instanceof LoadNode ld && ld.nOuts() == 1 ) - return new CmpMemX86(bool, address(ld), ld.ptr(), idx, off, scale, imm(lhs), val, true); + return new CmpMemX86(bool, address(ld), ld.ptr(), idx, off, scale, imm(lhs), val, true ); // Vs immediate if( rhs instanceof ConstantNode con && con._con instanceof TypeInteger ti && imm32(ti.value()) ) @@ -624,9 +624,7 @@ public class x86_64_v2 extends Machine { ld.mem() == st.mem() && ld.ptr() == st.ptr() && ld.off() == st.off()) { - if( op instanceof AddNode ) - return new MemAddX86(address(st), st.ptr(), idx, off, scale, imm(op.in(2)), val); - throw Utils.TODO(); + return new MemAddX86(address(st), st.ptr(), idx, off, scale, imm(op.in(2)), val); } } |
