diff --git a/src/xenia/cpu/backend/x64/x64_sequences.cc b/src/xenia/cpu/backend/x64/x64_sequences.cc index a6b78feb5..a99ace327 100644 --- a/src/xenia/cpu/backend/x64/x64_sequences.cc +++ b/src/xenia/cpu/backend/x64/x64_sequences.cc @@ -3299,7 +3299,11 @@ EMITTER(MUL_HI_I8, MATCH(I, I8<>, I8<>>)) { } } } else { - e.mov(e.al, i.src1); + if (i.src1.is_constant) { + e.mov(e.al, i.src1.constant()); + } else { + e.mov(e.al, i.src1); + } if (i.src2.is_constant) { e.mov(e.al, i.src2.constant()); e.imul(e.al); @@ -3339,7 +3343,11 @@ EMITTER(MUL_HI_I16, MATCH(I, I16<>, I16<>>)) { } } } else { - e.mov(e.ax, i.src1); + if (i.src1.is_constant) { + e.mov(e.ax, i.src1.constant()); + } else { + e.mov(e.ax, i.src1); + } if (i.src2.is_constant) { e.mov(e.dx, i.src2.constant()); e.imul(e.dx); @@ -3384,7 +3392,11 @@ EMITTER(MUL_HI_I32, MATCH(I, I32<>, I32<>>)) { } } } else { - e.mov(e.eax, i.src1); + if (i.src1.is_constant) { + e.mov(e.eax, i.src1.constant()); + } else { + e.mov(e.eax, i.src1); + } if (i.src2.is_constant) { e.mov(e.edx, i.src2.constant()); e.imul(e.edx); @@ -3429,7 +3441,11 @@ EMITTER(MUL_HI_I64, MATCH(I, I64<>, I64<>>)) { } } } else { - e.mov(e.rax, i.src1); + if (i.src1.is_constant) { + e.mov(e.rax, i.src1.constant()); + } else { + e.mov(e.rax, i.src1); + } if (i.src2.is_constant) { e.mov(e.rdx, i.src2.constant()); e.imul(e.rdx); diff --git a/src/xenia/cpu/frontend/test/bin/instr_eqv.bin b/src/xenia/cpu/frontend/test/bin/instr_eqv.bin index 35b148a57..c134dd441 100644 Binary files a/src/xenia/cpu/frontend/test/bin/instr_eqv.bin and b/src/xenia/cpu/frontend/test/bin/instr_eqv.bin differ diff --git a/src/xenia/cpu/frontend/test/bin/instr_eqv.dis b/src/xenia/cpu/frontend/test/bin/instr_eqv.dis index c7bfef7ff..bfb525b44 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_eqv.dis +++ b/src/xenia/cpu/frontend/test/bin/instr_eqv.dis @@ -4,22 +4,70 @@ Disassembly of section .text: 100000: 7c 83 2a 38 eqv r3,r4,r5 100004: 4e 80 00 20 blr -0000000000100008 : - 100008: 7c 83 2a 38 eqv r3,r4,r5 - 10000c: 4e 80 00 20 blr - -0000000000100010 : +0000000000100008 : + 100008: 38 80 00 00 li r4,0 + 10000c: 38 a0 00 01 li r5,1 100010: 7c 83 2a 38 eqv r3,r4,r5 100014: 4e 80 00 20 blr -0000000000100018 : +0000000000100018 : 100018: 7c 83 2a 38 eqv r3,r4,r5 10001c: 4e 80 00 20 blr -0000000000100020 : - 100020: 7c 83 2a 38 eqv r3,r4,r5 - 100024: 4e 80 00 20 blr - -0000000000100028 : +0000000000100020 : + 100020: 38 80 ff ff li r4,-1 + 100024: 38 a0 00 00 li r5,0 100028: 7c 83 2a 38 eqv r3,r4,r5 10002c: 4e 80 00 20 blr + +0000000000100030 : + 100030: 7c 83 2a 38 eqv r3,r4,r5 + 100034: 4e 80 00 20 blr + +0000000000100038 : + 100038: 38 80 ff ff li r4,-1 + 10003c: 38 a0 ff ff li r5,-1 + 100040: 7c 83 2a 38 eqv r3,r4,r5 + 100044: 4e 80 00 20 blr + +0000000000100048 : + 100048: 7c 83 2a 38 eqv r3,r4,r5 + 10004c: 4e 80 00 20 blr + +0000000000100050 : + 100050: 3c 80 de ad lis r4,-8531 + 100054: 60 84 be ef ori r4,r4,48879 + 100058: 78 85 07 c6 rldicr r5,r4,32,31 + 10005c: 78 84 00 20 clrldi r4,r4,32 + 100060: 7c a4 23 78 or r4,r5,r4 + 100064: 7c 85 23 78 mr r5,r4 + 100068: 7c 83 2a 38 eqv r3,r4,r5 + 10006c: 4e 80 00 20 blr + +0000000000100070 : + 100070: 7c 83 2a 38 eqv r3,r4,r5 + 100074: 4e 80 00 20 blr + +0000000000100078 : + 100078: 3c 80 de ad lis r4,-8531 + 10007c: 60 84 be ef ori r4,r4,48879 + 100080: 78 85 07 c6 rldicr r5,r4,32,31 + 100084: 78 84 00 20 clrldi r4,r4,32 + 100088: 7c a4 23 78 or r4,r5,r4 + 10008c: 38 a0 ff ff li r5,-1 + 100090: 7c 83 2a 38 eqv r3,r4,r5 + 100094: 4e 80 00 20 blr + +0000000000100098 : + 100098: 7c 83 2a 38 eqv r3,r4,r5 + 10009c: 4e 80 00 20 blr + +00000000001000a0 : + 1000a0: 3c 80 de ad lis r4,-8531 + 1000a4: 60 84 be ef ori r4,r4,48879 + 1000a8: 78 85 07 c6 rldicr r5,r4,32,31 + 1000ac: 78 84 00 20 clrldi r4,r4,32 + 1000b0: 7c a4 23 78 or r4,r5,r4 + 1000b4: 38 a0 00 00 li r5,0 + 1000b8: 7c 83 2a 38 eqv r3,r4,r5 + 1000bc: 4e 80 00 20 blr diff --git a/src/xenia/cpu/frontend/test/bin/instr_eqv.map b/src/xenia/cpu/frontend/test/bin/instr_eqv.map index 5b234eaec..51d902831 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_eqv.map +++ b/src/xenia/cpu/frontend/test/bin/instr_eqv.map @@ -1,6 +1,12 @@ 0000000000000000 t test_eqv_1 -0000000000000008 t test_eqv_2 -0000000000000010 t test_eqv_3 -0000000000000018 t test_eqv_4 -0000000000000020 t test_eqv_5 -0000000000000028 t test_eqv_6 +0000000000000008 t test_eqv_1_constant +0000000000000018 t test_eqv_2 +0000000000000020 t test_eqv_2_constant +0000000000000030 t test_eqv_3 +0000000000000038 t test_eqv_3_constant +0000000000000048 t test_eqv_4 +0000000000000050 t test_eqv_4_constant +0000000000000070 t test_eqv_5 +0000000000000078 t test_eqv_5_constant +0000000000000098 t test_eqv_6 +00000000000000a0 t test_eqv_6_constant diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvexx.bin b/src/xenia/cpu/frontend/test/bin/instr_lvexx.bin index 29aed79e2..0d1495754 100644 Binary files a/src/xenia/cpu/frontend/test/bin/instr_lvexx.bin and b/src/xenia/cpu/frontend/test/bin/instr_lvexx.bin differ diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvexx.dis b/src/xenia/cpu/frontend/test/bin/instr_lvexx.dis index 8c28024d9..7fdb3c2f0 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_lvexx.dis +++ b/src/xenia/cpu/frontend/test/bin/instr_lvexx.dis @@ -4,22 +4,52 @@ Disassembly of section .text: 100000: 7c 60 20 0e lvebx v3,0,r4 100004: 4e 80 00 20 blr -0000000000100008 : - 100008: 7c 60 20 0e lvebx v3,0,r4 - 10000c: 4e 80 00 20 blr +0000000000100008 : + 100008: 38 80 00 00 li r4,0 + 10000c: 7c 60 20 0e lvebx v3,0,r4 + 100010: 4e 80 00 20 blr -0000000000100010 : - 100010: 7c 60 20 4e lvehx v3,0,r4 - 100014: 4e 80 00 20 blr +0000000000100014 : + 100014: 7c 60 20 0e lvebx v3,0,r4 + 100018: 4e 80 00 20 blr -0000000000100018 : - 100018: 7c 60 20 4e lvehx v3,0,r4 - 10001c: 4e 80 00 20 blr - -0000000000100020 : - 100020: 7c 60 20 8e lvewx v3,0,r4 +000000000010001c : + 10001c: 38 80 00 04 li r4,4 + 100020: 7c 60 20 0e lvebx v3,0,r4 100024: 4e 80 00 20 blr -0000000000100028 : - 100028: 7c 60 20 8e lvewx v3,0,r4 +0000000000100028 : + 100028: 7c 60 20 4e lvehx v3,0,r4 10002c: 4e 80 00 20 blr + +0000000000100030 : + 100030: 38 80 00 00 li r4,0 + 100034: 7c 60 20 4e lvehx v3,0,r4 + 100038: 4e 80 00 20 blr + +000000000010003c : + 10003c: 7c 60 20 4e lvehx v3,0,r4 + 100040: 4e 80 00 20 blr + +0000000000100044 : + 100044: 38 80 00 04 li r4,4 + 100048: 7c 60 20 4e lvehx v3,0,r4 + 10004c: 4e 80 00 20 blr + +0000000000100050 : + 100050: 7c 60 20 8e lvewx v3,0,r4 + 100054: 4e 80 00 20 blr + +0000000000100058 : + 100058: 38 80 00 00 li r4,0 + 10005c: 7c 60 20 8e lvewx v3,0,r4 + 100060: 4e 80 00 20 blr + +0000000000100064 : + 100064: 7c 60 20 8e lvewx v3,0,r4 + 100068: 4e 80 00 20 blr + +000000000010006c : + 10006c: 38 80 00 04 li r4,4 + 100070: 7c 60 20 8e lvewx v3,0,r4 + 100074: 4e 80 00 20 blr diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvexx.map b/src/xenia/cpu/frontend/test/bin/instr_lvexx.map index 2e0940590..5308d578b 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_lvexx.map +++ b/src/xenia/cpu/frontend/test/bin/instr_lvexx.map @@ -1,6 +1,12 @@ 0000000000000000 t test_lvebx_1 -0000000000000008 t test_lvebx_2 -0000000000000010 t test_lvehx_1 -0000000000000018 t test_lvehx_2 -0000000000000020 t test_lvewx_1 -0000000000000028 t test_lvewx_2 +0000000000000008 t test_lvebx_1_constant +0000000000000014 t test_lvebx_2 +000000000000001c t test_lvebx_2_constant +0000000000000028 t test_lvehx_1 +0000000000000030 t test_lvehx_1_constant +000000000000003c t test_lvehx_2 +0000000000000044 t test_lvehx_2_constant +0000000000000050 t test_lvewx_1 +0000000000000058 t test_lvewx_1_constant +0000000000000064 t test_lvewx_2 +000000000000006c t test_lvewx_2_constant diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvl.bin b/src/xenia/cpu/frontend/test/bin/instr_lvl.bin index 671e6951f..dff227017 100644 Binary files a/src/xenia/cpu/frontend/test/bin/instr_lvl.bin and b/src/xenia/cpu/frontend/test/bin/instr_lvl.bin differ diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvl.dis b/src/xenia/cpu/frontend/test/bin/instr_lvl.dis index 9844e4b03..cc0115aad 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_lvl.dis +++ b/src/xenia/cpu/frontend/test/bin/instr_lvl.dis @@ -3,3 +3,8 @@ Disassembly of section .text: 0000000000100000 : 100000: 7c 64 04 0e lvlx v3,r4,r0 100004: 4e 80 00 20 blr + +0000000000100008 : + 100008: 38 80 10 77 li r4,4215 + 10000c: 7c 64 04 0e lvlx v3,r4,r0 + 100010: 4e 80 00 20 blr diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvl.map b/src/xenia/cpu/frontend/test/bin/instr_lvl.map index a5a3ba36c..f43fe3fa1 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_lvl.map +++ b/src/xenia/cpu/frontend/test/bin/instr_lvl.map @@ -1 +1,2 @@ 0000000000000000 t test_lvl_1 +0000000000000008 t test_lvl_1_constant diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvr.bin b/src/xenia/cpu/frontend/test/bin/instr_lvr.bin index a8e07544e..10f29611f 100644 Binary files a/src/xenia/cpu/frontend/test/bin/instr_lvr.bin and b/src/xenia/cpu/frontend/test/bin/instr_lvr.bin differ diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvr.dis b/src/xenia/cpu/frontend/test/bin/instr_lvr.dis index 326f29bdc..4620e3111 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_lvr.dis +++ b/src/xenia/cpu/frontend/test/bin/instr_lvr.dis @@ -3,3 +3,9 @@ Disassembly of section .text: 0000000000100000 : 100000: 7c 64 2c 4e lvrx v3,r4,r5 100004: 4e 80 00 20 blr + +0000000000100008 : + 100008: 38 80 10 b7 li r4,4279 + 10000c: 38 a0 00 10 li r5,16 + 100010: 7c 64 2c 4e lvrx v3,r4,r5 + 100014: 4e 80 00 20 blr diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvr.map b/src/xenia/cpu/frontend/test/bin/instr_lvr.map index 770c292eb..d86874b56 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_lvr.map +++ b/src/xenia/cpu/frontend/test/bin/instr_lvr.map @@ -1 +1,2 @@ 0000000000000000 t test_lvr_1 +0000000000000008 t test_lvr_1_constant diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvsl.bin b/src/xenia/cpu/frontend/test/bin/instr_lvsl.bin index c8d11323c..ce4cf4289 100644 Binary files a/src/xenia/cpu/frontend/test/bin/instr_lvsl.bin and b/src/xenia/cpu/frontend/test/bin/instr_lvsl.bin differ diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvsl.dis b/src/xenia/cpu/frontend/test/bin/instr_lvsl.dis index 3a70349f8..80b248453 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_lvsl.dis +++ b/src/xenia/cpu/frontend/test/bin/instr_lvsl.dis @@ -4,10 +4,25 @@ Disassembly of section .text: 100000: 7c 64 00 0c lvsl v3,r4,r0 100004: 4e 80 00 20 blr -0000000000100008 : - 100008: 7c 64 00 0c lvsl v3,r4,r0 - 10000c: 4e 80 00 20 blr +0000000000100008 : + 100008: 38 80 10 70 li r4,4208 + 10000c: 7c 64 00 0c lvsl v3,r4,r0 + 100010: 4e 80 00 20 blr -0000000000100010 : - 100010: 7c 64 00 0c lvsl v3,r4,r0 - 100014: 4e 80 00 20 blr +0000000000100014 : + 100014: 7c 64 00 0c lvsl v3,r4,r0 + 100018: 4e 80 00 20 blr + +000000000010001c : + 10001c: 38 80 10 71 li r4,4209 + 100020: 7c 64 00 0c lvsl v3,r4,r0 + 100024: 4e 80 00 20 blr + +0000000000100028 : + 100028: 7c 64 00 0c lvsl v3,r4,r0 + 10002c: 4e 80 00 20 blr + +0000000000100030 : + 100030: 38 80 10 7f li r4,4223 + 100034: 7c 64 00 0c lvsl v3,r4,r0 + 100038: 4e 80 00 20 blr diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvsl.map b/src/xenia/cpu/frontend/test/bin/instr_lvsl.map index 9092d008f..81ddc9d6e 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_lvsl.map +++ b/src/xenia/cpu/frontend/test/bin/instr_lvsl.map @@ -1,3 +1,6 @@ 0000000000000000 t test_lvsl_1 -0000000000000008 t test_lvsl_2 -0000000000000010 t test_lvsl_3 +0000000000000008 t test_lvsl_1_constant +0000000000000014 t test_lvsl_2 +000000000000001c t test_lvsl_2_constant +0000000000000028 t test_lvsl_3 +0000000000000030 t test_lvsl_3_constant diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvsr.bin b/src/xenia/cpu/frontend/test/bin/instr_lvsr.bin index 7ea145691..e2ed022cb 100644 Binary files a/src/xenia/cpu/frontend/test/bin/instr_lvsr.bin and b/src/xenia/cpu/frontend/test/bin/instr_lvsr.bin differ diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvsr.dis b/src/xenia/cpu/frontend/test/bin/instr_lvsr.dis index a870e00b8..81d01b7ac 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_lvsr.dis +++ b/src/xenia/cpu/frontend/test/bin/instr_lvsr.dis @@ -4,10 +4,25 @@ Disassembly of section .text: 100000: 7c 64 00 4c lvsr v3,r4,r0 100004: 4e 80 00 20 blr -0000000000100008 : - 100008: 7c 64 00 4c lvsr v3,r4,r0 - 10000c: 4e 80 00 20 blr +0000000000100008 : + 100008: 38 80 10 70 li r4,4208 + 10000c: 7c 64 00 4c lvsr v3,r4,r0 + 100010: 4e 80 00 20 blr -0000000000100010 : - 100010: 7c 64 00 4c lvsr v3,r4,r0 - 100014: 4e 80 00 20 blr +0000000000100014 : + 100014: 7c 64 00 4c lvsr v3,r4,r0 + 100018: 4e 80 00 20 blr + +000000000010001c : + 10001c: 38 80 10 71 li r4,4209 + 100020: 7c 64 00 4c lvsr v3,r4,r0 + 100024: 4e 80 00 20 blr + +0000000000100028 : + 100028: 7c 64 00 4c lvsr v3,r4,r0 + 10002c: 4e 80 00 20 blr + +0000000000100030 : + 100030: 38 80 10 7f li r4,4223 + 100034: 7c 64 00 4c lvsr v3,r4,r0 + 100038: 4e 80 00 20 blr diff --git a/src/xenia/cpu/frontend/test/bin/instr_lvsr.map b/src/xenia/cpu/frontend/test/bin/instr_lvsr.map index daf1ee1cc..3dcbe79f9 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_lvsr.map +++ b/src/xenia/cpu/frontend/test/bin/instr_lvsr.map @@ -1,3 +1,6 @@ 0000000000000000 t test_lvsr_1 -0000000000000008 t test_lvsr_2 -0000000000000010 t test_lvsr_3 +0000000000000008 t test_lvsr_1_constant +0000000000000014 t test_lvsr_2 +000000000000001c t test_lvsr_2_constant +0000000000000028 t test_lvsr_3 +0000000000000030 t test_lvsr_3_constant diff --git a/src/xenia/cpu/frontend/test/bin/instr_mulhd.bin b/src/xenia/cpu/frontend/test/bin/instr_mulhd.bin index 7b4ce8e35..d14778244 100644 Binary files a/src/xenia/cpu/frontend/test/bin/instr_mulhd.bin and b/src/xenia/cpu/frontend/test/bin/instr_mulhd.bin differ diff --git a/src/xenia/cpu/frontend/test/bin/instr_mulhd.dis b/src/xenia/cpu/frontend/test/bin/instr_mulhd.dis index fae492834..a6ea9ea2e 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_mulhd.dis +++ b/src/xenia/cpu/frontend/test/bin/instr_mulhd.dis @@ -4,18 +4,48 @@ Disassembly of section .text: 100000: 7c 64 28 92 mulhd r3,r4,r5 100004: 4e 80 00 20 blr -0000000000100008 : - 100008: 7c 64 28 92 mulhd r3,r4,r5 - 10000c: 4e 80 00 20 blr - -0000000000100010 : +0000000000100008 : + 100008: 38 80 00 01 li r4,1 + 10000c: 38 a0 00 00 li r5,0 100010: 7c 64 28 92 mulhd r3,r4,r5 100014: 4e 80 00 20 blr -0000000000100018 : +0000000000100018 : 100018: 7c 64 28 92 mulhd r3,r4,r5 10001c: 4e 80 00 20 blr -0000000000100020 : - 100020: 7c 64 28 92 mulhd r3,r4,r5 - 100024: 4e 80 00 20 blr +0000000000100020 : + 100020: 38 80 ff ff li r4,-1 + 100024: 38 a0 00 01 li r5,1 + 100028: 7c 64 28 92 mulhd r3,r4,r5 + 10002c: 4e 80 00 20 blr + +0000000000100030 : + 100030: 7c 64 28 92 mulhd r3,r4,r5 + 100034: 4e 80 00 20 blr + +0000000000100038 : + 100038: 38 80 ff ff li r4,-1 + 10003c: 38 a0 00 02 li r5,2 + 100040: 7c 64 28 92 mulhd r3,r4,r5 + 100044: 4e 80 00 20 blr + +0000000000100048 : + 100048: 7c 64 28 92 mulhd r3,r4,r5 + 10004c: 4e 80 00 20 blr + +0000000000100050 : + 100050: 38 a0 00 01 li r5,1 + 100054: 78 a4 f8 06 rldicr r4,r5,63,0 + 100058: 7c 64 28 92 mulhd r3,r4,r5 + 10005c: 4e 80 00 20 blr + +0000000000100060 : + 100060: 7c 64 28 92 mulhd r3,r4,r5 + 100064: 4e 80 00 20 blr + +0000000000100068 : + 100068: 38 80 ff ff li r4,-1 + 10006c: 38 a0 ff ff li r5,-1 + 100070: 7c 64 28 92 mulhd r3,r4,r5 + 100074: 4e 80 00 20 blr diff --git a/src/xenia/cpu/frontend/test/bin/instr_mulhd.map b/src/xenia/cpu/frontend/test/bin/instr_mulhd.map index 3699fc0f3..0a067f460 100644 --- a/src/xenia/cpu/frontend/test/bin/instr_mulhd.map +++ b/src/xenia/cpu/frontend/test/bin/instr_mulhd.map @@ -1,5 +1,10 @@ 0000000000000000 t test_mulhd_1 -0000000000000008 t test_mulhd_2 -0000000000000010 t test_mulhd_3 -0000000000000018 t test_mulhd_4 -0000000000000020 t test_mulhd_5 +0000000000000008 t test_mulhd_1_constant +0000000000000018 t test_mulhd_2 +0000000000000020 t test_mulhd_2_constant +0000000000000030 t test_mulhd_3 +0000000000000038 t test_mulhd_3_constant +0000000000000048 t test_mulhd_4 +0000000000000050 t test_mulhd_4_constant +0000000000000060 t test_mulhd_5 +0000000000000068 t test_mulhd_5_constant