mirror of
https://github.com/open-goal/jak-project
synced 2026-05-29 16:45:10 -04:00
[OpenGOAL] make multiplication/divsion like GOAL and support in decompiler (#483)
* support in compiler * multiplication in the decompiler * update divisions
This commit is contained in:
@@ -843,29 +843,17 @@ TEST_F(FormRegressionTest, SetDisplayEnv) {
|
||||
std::string type = "(function display-env int int int int int int display-env)";
|
||||
std::string expected =
|
||||
"(begin\n"
|
||||
" (set!\n"
|
||||
" (-> arg0 pmode)\n"
|
||||
" (new (quote static) (quote gs-pmode) :en1 1 :mmod 1 :slbg 1 :alp 255)\n"
|
||||
" )\n"
|
||||
" (set! (-> arg0 smode2) (new (quote static) (quote gs-smode2) :int 1 :ffmd 1))\n"
|
||||
" (set! (-> arg0 pmode) (new 'static 'gs-pmode :en1 1 :mmod 1 :slbg 1 :alp 255))\n"
|
||||
" (set! (-> arg0 smode2) (new 'static 'gs-smode2 :int 1 :ffmd 1))\n"
|
||||
" (set!\n"
|
||||
" (-> arg0 dspfb)\n"
|
||||
" (new\n"
|
||||
" (quote static)\n"
|
||||
" (quote gs-display-fb)\n"
|
||||
" :psm\n"
|
||||
" arg1\n"
|
||||
" :fbw\n"
|
||||
" (sar arg2 6)\n"
|
||||
" :fbp\n"
|
||||
" arg6\n"
|
||||
" )\n"
|
||||
" (new 'static 'gs-display-fb :psm arg1 :fbw (/ arg2 64) :fbp arg6)\n"
|
||||
" )\n"
|
||||
" (set!\n"
|
||||
" (-> arg0 display)\n"
|
||||
" (new\n"
|
||||
" (quote static)\n"
|
||||
" (quote gs-display)\n"
|
||||
" 'static\n"
|
||||
" 'gs-display\n"
|
||||
" :dw\n"
|
||||
" 2559\n"
|
||||
" :dy\n"
|
||||
@@ -873,12 +861,12 @@ TEST_F(FormRegressionTest, SetDisplayEnv) {
|
||||
" :dx\n"
|
||||
" (+ (* arg4 (/ 2560 arg2)) 652)\n"
|
||||
" :dh\n"
|
||||
" (+ (shl arg3 1) -1)\n"
|
||||
" (+ (* arg3 2) -1)\n"
|
||||
" :magh\n"
|
||||
" (+ (/ (+ arg2 2559) arg2) -1)\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (set! (-> arg0 bgcolor) (new (quote static) (quote gs-bgcolor)))\n"
|
||||
" (set! (-> arg0 bgcolor) (new 'static 'gs-bgcolor))\n"
|
||||
" arg0\n"
|
||||
" )";
|
||||
test_with_expr(func, type, expected);
|
||||
@@ -964,8 +952,8 @@ TEST_F(FormRegressionTest, DmaBufferAddVuFunction) {
|
||||
" (set!\n"
|
||||
" (-> (the-as dma-packet t2-0) dma)\n"
|
||||
" (new\n"
|
||||
" (quote static)\n"
|
||||
" (quote dma-tag)\n"
|
||||
" 'static\n"
|
||||
" 'dma-tag\n"
|
||||
" :id\n"
|
||||
" (dma-tag-id ref)\n"
|
||||
" :addr\n"
|
||||
@@ -976,21 +964,21 @@ TEST_F(FormRegressionTest, DmaBufferAddVuFunction) {
|
||||
" )\n"
|
||||
" (set!\n"
|
||||
" (-> (the-as dma-packet t2-0) vif0)\n"
|
||||
" (new (quote static) (quote vif-tag) :cmd (if (zero? arg2)\n"
|
||||
" 16\n"
|
||||
" 19\n"
|
||||
" )\n"
|
||||
" (new 'static 'vif-tag :cmd (if (zero? arg2)\n"
|
||||
" 16\n"
|
||||
" 19\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (set!\n"
|
||||
" (-> (the-as dma-packet t2-0) vif1)\n"
|
||||
" (new (quote static) (quote vif-tag) :cmd (vif-cmd mpg) :num (shl t0-1 1) :imm a1-1)\n"
|
||||
" (new 'static 'vif-tag :cmd (vif-cmd mpg) :num (* t0-1 2) :imm a1-1)\n"
|
||||
" )\n"
|
||||
" (set! (-> t1-1 base) (&+ (the-as pointer t2-0) 16))\n"
|
||||
" )\n"
|
||||
" (&+! v1-0 (shl t0-1 4))\n"
|
||||
" (&+! v1-0 (* t0-1 16))\n"
|
||||
" (set! a3-0 (- a3-0 t0-1))\n"
|
||||
" (+! a1-1 (shl t0-1 1))\n"
|
||||
" (+! a1-1 (* t0-1 2))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
@@ -1013,7 +1001,8 @@ TEST_F(FormRegressionTest, DmaBucketInsertTag) {
|
||||
std::string type = "(function dma-bucket int pointer (pointer dma-tag) pointer)";
|
||||
std::string expected =
|
||||
"(begin\n"
|
||||
" (let ((v1-1 (the-as dma-bucket (+ (the-as uint arg0) (the-as uint (shl arg1 4))))))\n"
|
||||
" (let\n"
|
||||
" ((v1-1 (the-as dma-bucket (+ (the-as uint arg0) (the-as uint (* arg1 16))))))\n"
|
||||
" (set! (-> (the-as dma-bucket (-> v1-1 last)) next) (the-as uint arg2))\n"
|
||||
" (set! (-> v1-1 last) arg3)\n"
|
||||
" )\n"
|
||||
|
||||
Reference in New Issue
Block a user