mirror of
https://github.com/open-goal/jak-project
synced 2026-08-03 17:02:47 -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:
@@ -41,9 +41,7 @@
|
||||
dma-bucket-insert-tag
|
||||
((base dma-bucket) (idx int) (tag-start pointer) (tag-end (pointer dma-tag)))
|
||||
(let
|
||||
((bucket
|
||||
(the-as dma-bucket (+ (the-as uint base) (the-as uint (shl idx 4))))
|
||||
)
|
||||
((bucket (the-as dma-bucket (+ (the-as uint base) (the-as uint (* idx 16)))))
|
||||
)
|
||||
(set! (-> (the-as dma-bucket (-> bucket last)) next) (the-as uint tag-start))
|
||||
(set! (-> bucket last) tag-end)
|
||||
@@ -54,6 +52,3 @@
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-0 0))
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -161,17 +161,13 @@
|
||||
)
|
||||
(set!
|
||||
(-> buf-ptr vif1)
|
||||
(new 'static 'vif-tag
|
||||
:cmd (vif-cmd mpg)
|
||||
:num (shl qwc-now 1)
|
||||
:imm origin
|
||||
)
|
||||
(new 'static 'vif-tag :cmd (vif-cmd mpg) :num (* qwc-now 2) :imm origin)
|
||||
)
|
||||
(set! (-> dma-buf-2 base) (&+ (the-as pointer buf-ptr) 16))
|
||||
)
|
||||
(&+! func-ptr (shl qwc-now 4))
|
||||
(&+! func-ptr (* qwc-now 16))
|
||||
(set! qlen (- qlen qwc-now))
|
||||
(+! origin (shl qwc-now 1))
|
||||
(+! origin (* qwc-now 2))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -211,8 +207,3 @@
|
||||
(dma-send-chain arg0 (the-as uint (-> arg1 data)))
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -268,11 +268,11 @@
|
||||
(format
|
||||
stream
|
||||
" #x~X: #x~2X #x~2X #x~2X #x~2X~%"
|
||||
(+ (+ (shl i 2) 4) (the-as int data))
|
||||
(-> data-ptr (shl i 2))
|
||||
(-> data-ptr (+ (shl i 2) 1))
|
||||
(-> data-ptr (+ (shl i 2) 2))
|
||||
(-> data-ptr (+ (shl i 2) 3))
|
||||
(+ (+ (* i 4) 4) (the-as int data))
|
||||
(-> data-ptr (* i 4))
|
||||
(-> data-ptr (+ (* i 4) 1))
|
||||
(-> data-ptr (+ (* i 4) 2))
|
||||
(-> data-ptr (+ (* i 4) 3))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -299,11 +299,11 @@
|
||||
(format
|
||||
stream
|
||||
" #x~X: #x~8x #x~8x #x~8x #x~8x~%"
|
||||
(+ (+ (shl s2-2 4) 4) (the-as int data))
|
||||
(-> s3-2 (shl s2-2 2))
|
||||
(-> s3-2 (+ (shl s2-2 2) 1))
|
||||
(-> s3-2 (+ (shl s2-2 2) 2))
|
||||
(-> s3-2 (+ (shl s2-2 2) 3))
|
||||
(+ (+ (* s2-2 16) 4) (the-as int data))
|
||||
(-> s3-2 (* s2-2 4))
|
||||
(-> s3-2 (+ (* s2-2 4) 1))
|
||||
(-> s3-2 (+ (* s2-2 4) 2))
|
||||
(-> s3-2 (+ (* s2-2 4) 3))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -314,11 +314,11 @@
|
||||
(format
|
||||
stream
|
||||
" #x~X: #x~4x #x~4x #x~4x #x~4x~%"
|
||||
(+ (+ (shl s2-3 3) 4) (the-as int data))
|
||||
(-> s3-3 (shl s2-3 2))
|
||||
(-> s3-3 (+ (shl s2-3 2) 1))
|
||||
(-> s3-3 (+ (shl s2-3 2) 2))
|
||||
(-> s3-3 (+ (shl s2-3 2) 3))
|
||||
(+ (+ (* s2-3 8) 4) (the-as int data))
|
||||
(-> s3-3 (* s2-3 4))
|
||||
(-> s3-3 (+ (* s2-3 4) 1))
|
||||
(-> s3-3 (+ (* s2-3 4) 2))
|
||||
(-> s3-3 (+ (* s2-3 4) 3))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -357,7 +357,7 @@
|
||||
(format
|
||||
stream
|
||||
" #x~X: #x~4x #x~4x~%"
|
||||
(+ (+ (shl s2-6 2) 4) (the-as int data))
|
||||
(+ (+ (* s2-6 4) 4) (the-as int data))
|
||||
(-> (&+ s3-6 (* 6 s2-6)) 0)
|
||||
(-> s3-6 (+ (* 3 s2-6) 1))
|
||||
)
|
||||
@@ -389,7 +389,7 @@
|
||||
(unpack-imm vif-unpack-imm)
|
||||
)
|
||||
(let ((byte-idx 0))
|
||||
(while (< byte-idx (shl words 2))
|
||||
(while (< byte-idx (* words 4))
|
||||
(let ((packet-size 4))
|
||||
(let ((first-tag (-> data 0)))
|
||||
(format stream " #x~X:" data)
|
||||
@@ -481,7 +481,7 @@
|
||||
(set! packet-size #x100000)
|
||||
(set!
|
||||
packet-size
|
||||
(the-as int (shl (the-as int (-> first-tag imm)) 4))
|
||||
(the-as int (* (-> first-tag imm) 16))
|
||||
)
|
||||
)
|
||||
(format
|
||||
@@ -497,11 +497,11 @@
|
||||
(format
|
||||
stream
|
||||
" #x~X: #x~8x #x~8x #x~8x #x~8x~%"
|
||||
(+ (+ (shl data-idx 4) 4) (the-as int data))
|
||||
(-> data-ptr (shl data-idx 2))
|
||||
(-> data-ptr (+ (shl data-idx 2) 1))
|
||||
(-> data-ptr (+ (shl data-idx 2) 2))
|
||||
(-> data-ptr (+ (shl data-idx 2) 3))
|
||||
(+ (+ (* data-idx 16) 4) (the-as int data))
|
||||
(-> data-ptr (* data-idx 4))
|
||||
(-> data-ptr (+ (* data-idx 4) 1))
|
||||
(-> data-ptr (+ (* data-idx 4) 2))
|
||||
(-> data-ptr (+ (* data-idx 4) 3))
|
||||
)
|
||||
(set! data-idx (+ data-idx 1))
|
||||
)
|
||||
@@ -578,7 +578,7 @@
|
||||
(&+! data packet-size)
|
||||
)
|
||||
)
|
||||
(- byte-idx (shl words 2))
|
||||
(- byte-idx (* words 4))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -744,10 +744,7 @@
|
||||
(pointer vif-tag)
|
||||
(+ (the-as uint addr) (the-as uint v0-9))
|
||||
)
|
||||
(the-as
|
||||
int
|
||||
(- (shl (the-as int qwc) 2) (the-as uint (sar v0-9 2)))
|
||||
)
|
||||
(the-as int (- (* qwc 4) (the-as uint (/ v0-9 4))))
|
||||
stream-2
|
||||
(= mode-2 'details)
|
||||
)
|
||||
@@ -772,7 +769,7 @@
|
||||
(pointer vif-tag)
|
||||
(&-> (the-as (pointer uint64) data-2) 1)
|
||||
)
|
||||
(the-as int (+ (shl (the-as int qwc) 2) 2))
|
||||
(the-as int (+ (* qwc 4) 2))
|
||||
stream-2
|
||||
(= mode-2 'details)
|
||||
)
|
||||
@@ -783,10 +780,7 @@
|
||||
dma-packet
|
||||
(+
|
||||
(the-as uint data-2)
|
||||
(the-as
|
||||
uint
|
||||
(shl (the-as int (+ (the-as uint qwc) (the-as uint 1))) 4)
|
||||
)
|
||||
(the-as uint (* (+ (the-as uint qwc) (the-as uint 1)) 16))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -802,7 +796,7 @@
|
||||
(pointer vif-tag)
|
||||
(&-> (the-as (pointer uint64) data-2) 1)
|
||||
)
|
||||
(the-as int (+ (shl (the-as int qwc) 2) 2))
|
||||
(the-as int (+ (* qwc 4) 2))
|
||||
stream-2
|
||||
(= mode-2 'details)
|
||||
)
|
||||
@@ -826,7 +820,7 @@
|
||||
(pointer vif-tag)
|
||||
(&-> (the-as (pointer uint64) data-2) 1)
|
||||
)
|
||||
(the-as int (+ (shl (the-as int qwc) 2) 2))
|
||||
(the-as int (+ (* qwc 4) 2))
|
||||
stream-2
|
||||
(= mode-2 'details)
|
||||
)
|
||||
@@ -855,7 +849,7 @@
|
||||
(pointer vif-tag)
|
||||
(&-> (the-as (pointer uint64) data-2) 1)
|
||||
)
|
||||
(the-as int (+ (shl (the-as int qwc) 2) 2))
|
||||
(the-as int (+ (* qwc 4) 2))
|
||||
stream-2
|
||||
(= mode-2 'details)
|
||||
)
|
||||
@@ -891,7 +885,7 @@
|
||||
(pointer vif-tag)
|
||||
(&-> (the-as (pointer uint64) data-2) 1)
|
||||
)
|
||||
(the-as int (+ (shl (the-as int qwc) 2) 2))
|
||||
(the-as int (+ (* qwc 4) 2))
|
||||
stream-2
|
||||
(= mode-2 'details)
|
||||
)
|
||||
|
||||
@@ -294,18 +294,18 @@
|
||||
0
|
||||
"~4,'0X: ~8,'0X ~8,'0X ~8,'0X ~8,'0X"
|
||||
s5-0
|
||||
(-> gp-0 (shl s5-0 2))
|
||||
(-> gp-0 (+ (shl s5-0 2) 1))
|
||||
(-> gp-0 (+ (shl s5-0 2) 2))
|
||||
(-> gp-0 (+ (shl s5-0 2) 3))
|
||||
(-> gp-0 (* s5-0 4))
|
||||
(-> gp-0 (+ (* s5-0 4) 1))
|
||||
(-> gp-0 (+ (* s5-0 4) 2))
|
||||
(-> gp-0 (+ (* s5-0 4) 3))
|
||||
)
|
||||
(format
|
||||
0
|
||||
" ~F ~F ~F ~F ~%"
|
||||
(-> gp-0 (shl s5-0 2))
|
||||
(-> gp-0 (+ (shl s5-0 2) 1))
|
||||
(-> gp-0 (+ (shl s5-0 2) 2))
|
||||
(-> gp-0 (+ (shl s5-0 2) 3))
|
||||
(-> gp-0 (* s5-0 4))
|
||||
(-> gp-0 (+ (* s5-0 4) 1))
|
||||
(-> gp-0 (+ (* s5-0 4) 2))
|
||||
(-> gp-0 (+ (* s5-0 4) 3))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -321,18 +321,18 @@
|
||||
0
|
||||
"~4,'0X: ~8x ~8x ~8x ~8x"
|
||||
s2-0
|
||||
(-> s4-0 (shl s2-0 2))
|
||||
(-> s4-0 (+ (shl s2-0 2) 1))
|
||||
(-> s4-0 (+ (shl s2-0 2) 2))
|
||||
(-> s4-0 (+ (shl s2-0 2) 3))
|
||||
(-> s4-0 (* s2-0 4))
|
||||
(-> s4-0 (+ (* s2-0 4) 1))
|
||||
(-> s4-0 (+ (* s2-0 4) 2))
|
||||
(-> s4-0 (+ (* s2-0 4) 3))
|
||||
)
|
||||
(format
|
||||
0
|
||||
" ~F ~F ~F ~F ~%"
|
||||
(-> s4-0 (shl s2-0 2))
|
||||
(-> s4-0 (+ (shl s2-0 2) 1))
|
||||
(-> s4-0 (+ (shl s2-0 2) 2))
|
||||
(-> s4-0 (+ (shl s2-0 2) 3))
|
||||
(-> s4-0 (* s2-0 4))
|
||||
(-> s4-0 (+ (* s2-0 4) 1))
|
||||
(-> s4-0 (+ (* s2-0 4) 2))
|
||||
(-> s4-0 (+ (* s2-0 4) 3))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -385,7 +385,7 @@
|
||||
(set! (-> spr-to-bank chcr) (new 'static 'dma-chcr :str #x1))
|
||||
(.sync.l)
|
||||
(dma-sync (the-as pointer spr-to-bank) 0 0)
|
||||
(&+! src (shl qwc-transferred-now 4))
|
||||
(&+! src (* qwc-transferred-now 16))
|
||||
(set! (-> spr-from-bank madr) (the-as uint dst))
|
||||
(set! (-> spr-from-bank sadr) (the-as uint 0))
|
||||
(set! (-> spr-from-bank qwc) (the-as uint qwc-transferred-now))
|
||||
@@ -393,7 +393,7 @@
|
||||
(set! (-> spr-from-bank chcr) (new 'static 'dma-chcr :str #x1))
|
||||
(.sync.l)
|
||||
(dma-sync (the-as pointer spr-from-bank) 0 0)
|
||||
(&+! dst (shl qwc-transferred-now 4))
|
||||
(&+! dst (* qwc-transferred-now 16))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -410,9 +410,3 @@
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(dma-initialize)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -167,10 +167,7 @@
|
||||
(object-new
|
||||
allocation
|
||||
type-to-make
|
||||
(the-as
|
||||
int
|
||||
(+ (-> type-to-make size) (the-as uint (shl (+ length -1) 5)))
|
||||
)
|
||||
(the-as int (+ (-> type-to-make size) (the-as uint (* (+ length -1) 32))))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -291,7 +288,7 @@
|
||||
(defmethod asize-of engine ((obj engine))
|
||||
(the-as
|
||||
int
|
||||
(+ (-> engine size) (the-as uint (shl (+ (-> obj allocated-length) -1) 5)))
|
||||
(+ (-> engine size) (the-as uint (* (+ (-> obj allocated-length) -1) 32)))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -542,7 +539,3 @@
|
||||
)
|
||||
0
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -104,32 +104,14 @@
|
||||
(height (-> *video-parms* screen-sy))
|
||||
(file (new 'debug 'file-stream "image.raw" 'write))
|
||||
)
|
||||
(let ((buff0 (new 'debug 'boxed-array uint128 (sar (* width height) 2))))
|
||||
(let ((buff1 (new 'debug 'boxed-array uint128 (sar (* width height) 2))))
|
||||
(let ((buff0 (new 'debug 'boxed-array uint128 (/ (* width height) 4))))
|
||||
(let ((buff1 (new 'debug 'boxed-array uint128 (/ (* width height) 4))))
|
||||
(let ((packet (new 'static 'gs-store-image-packet)))
|
||||
(gs-set-default-store-image
|
||||
packet
|
||||
#x2800
|
||||
(sar width 6)
|
||||
0
|
||||
0
|
||||
0
|
||||
width
|
||||
height
|
||||
)
|
||||
(gs-set-default-store-image packet #x2800 (/ width 64) 0 0 0 width height)
|
||||
(flush-cache 0)
|
||||
(gs-store-image packet (-> buff0 data))
|
||||
(sync-path 0 0)
|
||||
(gs-set-default-store-image
|
||||
packet
|
||||
#x3000
|
||||
(sar width 6)
|
||||
0
|
||||
0
|
||||
0
|
||||
width
|
||||
height
|
||||
)
|
||||
(gs-set-default-store-image packet #x3000 (/ width 64) 0 0 0 width height)
|
||||
(flush-cache 0)
|
||||
(gs-store-image packet (-> buff1 data))
|
||||
)
|
||||
@@ -142,13 +124,13 @@
|
||||
(while (< y-idx height)
|
||||
(file-stream-write
|
||||
file
|
||||
(&+ ptr-0 (* y-idx (shl width 2)))
|
||||
(the-as uint (shl width 2))
|
||||
(&+ ptr-0 (* y-idx (* width 4)))
|
||||
(the-as uint (* width 4))
|
||||
)
|
||||
(file-stream-write
|
||||
file
|
||||
(&+ ptr-1 (* y-idx (shl width 2)))
|
||||
(the-as uint (shl width 2))
|
||||
(&+ ptr-1 (* y-idx (* width 4)))
|
||||
(the-as uint (* width 4))
|
||||
)
|
||||
(set! y-idx (+ y-idx 1))
|
||||
)
|
||||
@@ -158,13 +140,13 @@
|
||||
(while (< y-idx-2 height)
|
||||
(file-stream-write
|
||||
file
|
||||
(&+ ptr-1 (* y-idx-2 (shl width 2)))
|
||||
(the-as uint (shl width 2))
|
||||
(&+ ptr-1 (* y-idx-2 (* width 4)))
|
||||
(the-as uint (* width 4))
|
||||
)
|
||||
(file-stream-write
|
||||
file
|
||||
(&+ ptr-0 (* y-idx-2 (shl width 2)))
|
||||
(the-as uint (shl width 2))
|
||||
(&+ ptr-0 (* y-idx-2 (* width 4)))
|
||||
(the-as uint (* width 4))
|
||||
)
|
||||
(set! y-idx-2 (+ y-idx-2 1))
|
||||
)
|
||||
@@ -182,6 +164,3 @@
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -778,7 +778,7 @@
|
||||
:th (log2 (-> tex h))
|
||||
:tw (log2 (-> tex w))
|
||||
:tbw (-> tex width 0)
|
||||
:tbp0 (sar tex-addr 6)
|
||||
:tbp0 (/ (the-as int tex-addr) 64)
|
||||
:psm psm
|
||||
)
|
||||
)
|
||||
|
||||
@@ -805,8 +805,8 @@
|
||||
(format #t "~Teop : ~4d~%" (shr (shl (the-as int gp-0) 48) 63))
|
||||
(format #t "~Tid : ~4d~%" (shr (shl (the-as int gp-0) 18) 50))
|
||||
(format #t "~Tpre : ~4d~%" (shr (shl (the-as int gp-0) 17) 63))
|
||||
(format #t "~Tprim : ~4d~%" (shr (shl (the-as int gp-0) 6) 53))
|
||||
(format #t "~Tflg : ~4d~%" (shr (shl (the-as int gp-0) 4) 62))
|
||||
(format #t "~Tprim : ~4d~%" (shr (* gp-0 64) 53))
|
||||
(format #t "~Tflg : ~4d~%" (shr (* gp-0 16) 62))
|
||||
(format #t "~Tnreg : ~4d~%" (shr (the-as int gp-0) 60))
|
||||
(let ((t9-8 format)
|
||||
(a0-9 #t)
|
||||
@@ -905,14 +905,14 @@
|
||||
(a1-21 "~Tregs13: ~4d~%")
|
||||
)
|
||||
(.pcpyud v1-31 gp-0 r0-0)
|
||||
(t9-21 a0-22 a1-21 (shr (shl (the-as int v1-31) 8) 60))
|
||||
(t9-21 a0-22 a1-21 (shr (* v1-31 256) 60))
|
||||
)
|
||||
(let ((t9-22 format)
|
||||
(a0-23 #t)
|
||||
(a1-22 "~Tregs14: ~4d~%")
|
||||
)
|
||||
(.pcpyud v1-33 gp-0 r0-0)
|
||||
(t9-22 a0-23 a1-22 (shr (shl (the-as int v1-33) 4) 60))
|
||||
(t9-22 a0-23 a1-22 (shr (* v1-33 16) 60))
|
||||
)
|
||||
(let ((t9-23 format)
|
||||
(a0-24 #t)
|
||||
@@ -1053,7 +1053,7 @@
|
||||
(object-new
|
||||
allocation
|
||||
type-to-make
|
||||
(the-as int (+ (-> type-to-make size) (the-as uint (shl (+ arg0 -1) 3))))
|
||||
(the-as int (+ (-> type-to-make size) (the-as uint (* (+ arg0 -1) 8))))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1072,7 +1072,7 @@
|
||||
(-> tag regs)
|
||||
(logior
|
||||
(-> tag regs)
|
||||
(the-as uint (ash reg-idx (shl (-> packet reg-count) 2)))
|
||||
(the-as uint (ash reg-idx (* (-> packet reg-count) 4)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
(set! (-> s5-0 z) f0-2)
|
||||
)
|
||||
)
|
||||
(when (= (logand (sar (the int (-> s5-0 w)) 2) 1) 1)
|
||||
(when (= (logand (/ (the int (-> s5-0 w)) 4) 1) 1)
|
||||
(set! (-> s5-0 x) (- (-> s5-0 x)))
|
||||
(set! (-> s5-0 y) (- (-> s5-0 y)))
|
||||
(set! (-> s5-0 z) (- (-> s5-0 z)))
|
||||
@@ -46,18 +46,18 @@
|
||||
)
|
||||
(let ((v1-9 0))
|
||||
)
|
||||
(let* ((v1-12 (logand (sar (the int (-> s5-0 w)) 2) 1))
|
||||
(a1-2 (-> EulSafe (logand (sar (the int (-> s5-0 w)) 3) 3)))
|
||||
(let* ((v1-12 (logand (/ (the int (-> s5-0 w)) 4) 1))
|
||||
(a1-2 (-> EulSafe (logand (/ (the int (-> s5-0 w)) 8) 3)))
|
||||
(a0-21 (-> EulNext (+ a1-2 v1-12)))
|
||||
(v1-17 (-> EulNext (+ (- 1 v1-12) a1-2)))
|
||||
)
|
||||
(cond
|
||||
((= (logand (sar (the int (-> s5-0 w)) 1) 1) 1)
|
||||
((= (logand (/ (the int (-> s5-0 w)) 2) 1) 1)
|
||||
(set!
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a1-2 4) (shl a1-2 2)) (the-as int arg0))
|
||||
(+ (+ (* a1-2 16) (* a1-2 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
f30-0
|
||||
@@ -66,7 +66,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a1-2 4) (shl a0-21 2)) (the-as int arg0))
|
||||
(+ (+ (* a1-2 16) (* a0-21 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(* f28-0 f24-0)
|
||||
@@ -75,7 +75,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a1-2 4) (shl v1-17 2)) (the-as int arg0))
|
||||
(+ (+ (* a1-2 16) (* v1-17 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(* f28-0 f26-0)
|
||||
@@ -84,7 +84,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a0-21 4) (shl a1-2 2)) (the-as int arg0))
|
||||
(+ (+ (* a0-21 16) (* a1-2 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(* f28-0 f4-0)
|
||||
@@ -93,7 +93,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a0-21 4) (shl a0-21 2)) (the-as int arg0))
|
||||
(+ (+ (* a0-21 16) (* a0-21 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(- f0-17 (* f30-0 f3-0))
|
||||
@@ -102,7 +102,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a0-21 4) (shl v1-17 2)) (the-as int arg0))
|
||||
(+ (+ (* a0-21 16) (* v1-17 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(- (- f2-0) (* f30-0 f1-1))
|
||||
@@ -111,7 +111,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl v1-17 4) (shl a1-2 2)) (the-as int arg0))
|
||||
(+ (+ (* v1-17 16) (* a1-2 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(- (* f28-0 f22-0))
|
||||
@@ -120,7 +120,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl v1-17 4) (shl a0-21 2)) (the-as int arg0))
|
||||
(+ (+ (* v1-17 16) (* a0-21 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(+ f1-1 (* f30-0 f2-0))
|
||||
@@ -129,7 +129,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl v1-17 4) (shl v1-17 2)) (the-as int arg0))
|
||||
(+ (+ (* v1-17 16) (* v1-17 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(+ (- f3-0) (* f30-0 f0-17))
|
||||
@@ -140,7 +140,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a1-2 4) (shl a1-2 2)) (the-as int arg0))
|
||||
(+ (+ (* a1-2 16) (* a1-2 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(* f30-0 f22-0)
|
||||
@@ -149,7 +149,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a1-2 4) (shl a0-21 2)) (the-as int arg0))
|
||||
(+ (+ (* a1-2 16) (* a0-21 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(+ (- f1-1) (* f28-0 f2-0))
|
||||
@@ -158,7 +158,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a1-2 4) (shl v1-17 2)) (the-as int arg0))
|
||||
(+ (+ (* a1-2 16) (* v1-17 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(+ f3-0 (* f28-0 f0-17))
|
||||
@@ -167,7 +167,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a0-21 4) (shl a1-2 2)) (the-as int arg0))
|
||||
(+ (+ (* a0-21 16) (* a1-2 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(* f30-0 f4-0)
|
||||
@@ -176,7 +176,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a0-21 4) (shl a0-21 2)) (the-as int arg0))
|
||||
(+ (+ (* a0-21 16) (* a0-21 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(+ f0-17 (* f28-0 f3-0))
|
||||
@@ -185,7 +185,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a0-21 4) (shl v1-17 2)) (the-as int arg0))
|
||||
(+ (+ (* a0-21 16) (* v1-17 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(+ (- f2-0) (* f28-0 f1-1))
|
||||
@@ -194,7 +194,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl v1-17 4) (shl a1-2 2)) (the-as int arg0))
|
||||
(+ (+ (* v1-17 16) (* a1-2 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(- f28-0)
|
||||
@@ -203,7 +203,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl v1-17 4) (shl a0-21 2)) (the-as int arg0))
|
||||
(+ (+ (* v1-17 16) (* a0-21 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(* f30-0 f24-0)
|
||||
@@ -212,7 +212,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl v1-17 4) (shl v1-17 2)) (the-as int arg0))
|
||||
(+ (+ (* v1-17 16) (* v1-17 4)) (the-as int arg0))
|
||||
)
|
||||
)
|
||||
(* f30-0 f26-0)
|
||||
@@ -233,19 +233,19 @@
|
||||
)
|
||||
(let ((v1-2 0))
|
||||
)
|
||||
(let* ((v1-4 (logand (sar arg2 2) 1))
|
||||
(s3-0 (-> EulSafe (logand (sar arg2 3) 3)))
|
||||
(let* ((v1-4 (logand (/ arg2 4) 1))
|
||||
(s3-0 (-> EulSafe (logand (/ arg2 8) 3)))
|
||||
(s2-0 (-> EulNext (+ s3-0 v1-4)))
|
||||
(s1-0 (-> EulNext (+ (- 1 v1-4) s3-0)))
|
||||
)
|
||||
(cond
|
||||
((= (logand (sar arg2 1) 1) 1)
|
||||
((= (logand (/ arg2 2) 1) 1)
|
||||
(let*
|
||||
((f0-0
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s2-0 2) (shl s3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s2-0 4) (* s3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -254,7 +254,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s1-0 2) (shl s3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s1-0 4) (* s3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -268,13 +268,13 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s2-0 2) (shl s3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s2-0 4) (* s3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s1-0 2) (shl s3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s1-0 4) (* s3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -286,7 +286,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s3-0 2) (shl s3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -297,14 +297,14 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s3-0 2) (shl s2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
(-
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s3-0 2) (shl s1-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s3-0 4) (* s1-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -319,14 +319,14 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s1-0 2) (shl s2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s1-0 4) (* s2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s2-0 2) (shl s2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s2-0 4) (* s2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -338,7 +338,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s3-0 2) (shl s3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -354,7 +354,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s3-0 2) (shl s3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -363,7 +363,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s3-0 2) (shl s2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -377,13 +377,13 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s2-0 2) (shl s1-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s2-0 4) (* s1-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s1-0 2) (shl s1-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s1-0 4) (* s1-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -395,7 +395,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s3-0 2) (shl s1-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s3-0 4) (* s1-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -408,13 +408,13 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s3-0 2) (shl s2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s3-0 2) (shl s3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -428,14 +428,14 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s1-0 2) (shl s2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s1-0 4) (* s2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s2-0 2) (shl s2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s2-0 4) (* s2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -447,7 +447,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl s3-0 2) (shl s1-0 4)) (the-as int arg1))
|
||||
(+ (+ (* s3-0 4) (* s1-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -461,7 +461,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (= (logand (sar arg2 2) 1) 1)
|
||||
(when (= (logand (/ arg2 4) 1) 1)
|
||||
(set! (-> arg0 x) (- (-> arg0 x)))
|
||||
(set! (-> arg0 y) (- (-> arg0 y)))
|
||||
(set! (-> arg0 z) (- (-> arg0 z)))
|
||||
|
||||
@@ -481,7 +481,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a2-0 2) (shl a2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* a2-0 4) (* a2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
(-> arg1 data 10)
|
||||
@@ -500,13 +500,13 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a3-0 2) (shl a3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* a3-0 4) (* a3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl v1-1 2) (shl v1-1 4)) (the-as int arg1))
|
||||
(+ (+ (* v1-1 4) (* v1-1 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -514,7 +514,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a2-0 2) (shl a2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* a2-0 4) (* a2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -522,7 +522,7 @@
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> (the-as (pointer float) (+ (shl a2-0 2) (the-as int arg0))))
|
||||
(-> (the-as (pointer float) (+ (* a2-0 4) (the-as int arg0))))
|
||||
(* 0.5 f0-12)
|
||||
)
|
||||
(if (!= f0-12 0.0)
|
||||
@@ -535,13 +535,13 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl v1-1 2) (shl a3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* v1-1 4) (* a3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a3-0 2) (shl v1-1 4)) (the-as int arg1))
|
||||
(+ (+ (* a3-0 4) (* v1-1 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -549,19 +549,19 @@
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> (the-as (pointer float) (+ (shl a3-0 2) (the-as int arg0))))
|
||||
(-> (the-as (pointer float) (+ (* a3-0 4) (the-as int arg0))))
|
||||
(*
|
||||
(+
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a3-0 2) (shl a2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* a3-0 4) (* a2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a2-0 2) (shl a3-0 4)) (the-as int arg1))
|
||||
(+ (+ (* a2-0 4) (* a3-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -569,19 +569,19 @@
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> (the-as (pointer float) (+ (shl v1-1 2) (the-as int arg0))))
|
||||
(-> (the-as (pointer float) (+ (* v1-1 4) (the-as int arg0))))
|
||||
(*
|
||||
(+
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl v1-1 2) (shl a2-0 4)) (the-as int arg1))
|
||||
(+ (+ (* v1-1 4) (* a2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
(->
|
||||
(the-as
|
||||
(pointer float)
|
||||
(+ (+ (shl a2-0 2) (shl v1-1 4)) (the-as int arg1))
|
||||
(+ (+ (* a2-0 4) (* v1-1 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
allocation
|
||||
type-to-make
|
||||
(+
|
||||
(+ (sar (logand -8 (+ length 7)) 3) -1)
|
||||
(+ (/ (logand -8 (+ length 7)) 8) -1)
|
||||
(the-as int (-> type-to-make size))
|
||||
)
|
||||
)
|
||||
@@ -60,14 +60,14 @@
|
||||
int
|
||||
(+
|
||||
(-> obj type size)
|
||||
(the-as uint (sar (logand -8 (+ (-> obj allocated-length) 7)) 3))
|
||||
(the-as uint (/ (logand -8 (+ (-> obj allocated-length) 7)) 8))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 9 of type bit-array
|
||||
(defmethod get-bit bit-array ((obj bit-array) (arg0 int))
|
||||
(let ((v1-2 (-> obj bytes (sar arg0 3))))
|
||||
(let ((v1-2 (-> obj bytes (/ arg0 8))))
|
||||
(nonzero? (logand v1-2 (the-as uint (ash 1 (logand arg0 7)))))
|
||||
)
|
||||
)
|
||||
@@ -75,9 +75,9 @@
|
||||
;; definition for method 10 of type bit-array
|
||||
(defmethod clear-bit bit-array ((obj bit-array) (arg0 int))
|
||||
(set!
|
||||
(-> obj bytes (sar arg0 3))
|
||||
(-> obj bytes (/ arg0 8))
|
||||
(logand
|
||||
(-> obj bytes (sar arg0 3))
|
||||
(-> obj bytes (/ arg0 8))
|
||||
(the-as uint (lognot (ash 1 (logand arg0 7))))
|
||||
)
|
||||
)
|
||||
@@ -87,15 +87,15 @@
|
||||
;; definition for method 11 of type bit-array
|
||||
(defmethod set-bit bit-array ((obj bit-array) (arg0 int))
|
||||
(set!
|
||||
(-> obj bytes (sar arg0 3))
|
||||
(logior (-> obj bytes (sar arg0 3)) (the-as uint (ash 1 (logand arg0 7))))
|
||||
(-> obj bytes (/ arg0 8))
|
||||
(logior (-> obj bytes (/ arg0 8)) (the-as uint (ash 1 (logand arg0 7))))
|
||||
)
|
||||
0
|
||||
)
|
||||
|
||||
;; definition for method 12 of type bit-array
|
||||
(defmethod clear bit-array ((obj bit-array))
|
||||
(let ((idx (sar (logand -8 (+ (-> obj allocated-length) 7)) 3)))
|
||||
(let ((idx (/ (logand -8 (+ (-> obj allocated-length) 7)) 8)))
|
||||
(while (nonzero? idx)
|
||||
(+! idx -1)
|
||||
(nop!)
|
||||
@@ -963,7 +963,3 @@
|
||||
|
||||
;; definition for symbol *zero-vector*, type vector
|
||||
(define *zero-vector* (new 'static 'vector))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
;; definition for method 5 of type type
|
||||
;; INFO: Return type mismatch uint vs int.
|
||||
(defmethod asize-of type ((obj type))
|
||||
(the-as int (logand #xfffffff0 (+ (shl (-> obj allocated-length) 2) 43)))
|
||||
(the-as int (logand #xfffffff0 (+ (* (-> obj allocated-length) 4) 43)))
|
||||
)
|
||||
|
||||
;; definition for function basic-type?
|
||||
@@ -893,7 +893,7 @@
|
||||
;; Used lq/sq
|
||||
(defun qmem-copy<-! ((dst pointer) (src pointer) (size int))
|
||||
(let ((result dst))
|
||||
(let ((qwc (sar (+ size 15) 4)))
|
||||
(let ((qwc (/ (+ size 15) 16)))
|
||||
(while (nonzero? qwc)
|
||||
(+! qwc -1)
|
||||
(set!
|
||||
@@ -912,9 +912,9 @@
|
||||
;; Used lq/sq
|
||||
(defun qmem-copy->! ((dst pointer) (src pointer) (size int))
|
||||
(let ((result dst))
|
||||
(let* ((qwc (sar (+ size 15) 4))
|
||||
(dst-ptr (&+ dst (shl qwc 4)))
|
||||
(src-ptr (&+ src (shl qwc 4)))
|
||||
(let* ((qwc (/ (+ size 15) 16))
|
||||
(dst-ptr (&+ dst (* qwc 16)))
|
||||
(src-ptr (&+ src (* qwc 16)))
|
||||
)
|
||||
(while (nonzero? qwc)
|
||||
(+! qwc -1)
|
||||
@@ -995,15 +995,15 @@
|
||||
|
||||
;; definition (debug) for function mem-print
|
||||
(defun-debug mem-print ((data (pointer uint32)) (word-count int))
|
||||
(dotimes (current-qword (sar word-count 2))
|
||||
(dotimes (current-qword (/ word-count 4))
|
||||
(format
|
||||
0
|
||||
"~X: ~X ~X ~X ~X~%"
|
||||
(&-> data (shl current-qword 2))
|
||||
(-> data (shl current-qword 2))
|
||||
(-> data (+ (shl current-qword 2) 1))
|
||||
(-> data (+ (shl current-qword 2) 2))
|
||||
(-> data (+ (shl current-qword 2) 3))
|
||||
(&-> data (* current-qword 4))
|
||||
(-> data (* current-qword 4))
|
||||
(-> data (+ (* current-qword 4) 1))
|
||||
(-> data (+ (* current-qword 4) 2))
|
||||
(-> data (+ (* current-qword 4) 3))
|
||||
)
|
||||
)
|
||||
#f
|
||||
|
||||
@@ -1045,10 +1045,10 @@
|
||||
)
|
||||
)
|
||||
((< f0-2 0.2)
|
||||
(set! arg0 (shl arg0 2))
|
||||
(set! arg0 (* arg0 4))
|
||||
)
|
||||
((< f0-2 0.3)
|
||||
(set! arg0 (shl arg0 1))
|
||||
(set! arg0 (* arg0 2))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1489,7 +1489,7 @@
|
||||
arg0
|
||||
)
|
||||
(let ((s2-0 *print-column*))
|
||||
(set! *print-column* (the-as binteger (shl (shl arg1 2) 3)))
|
||||
(set! *print-column* (the-as binteger (* (* arg1 4) 8)))
|
||||
(inspect arg0)
|
||||
(set! *print-column* s2-0)
|
||||
)
|
||||
|
||||
@@ -575,7 +575,7 @@
|
||||
result
|
||||
(the-as
|
||||
int
|
||||
(+ (+ (-> next-char-2 0) -55) (the-as uint (shl result 4)))
|
||||
(+ (+ (-> next-char-2 0) -55) (the-as uint (* result 16)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -589,14 +589,14 @@
|
||||
result
|
||||
(the-as
|
||||
int
|
||||
(+ (+ (-> next-char-2 0) -87) (the-as uint (shl result 4)))
|
||||
(+ (+ (-> next-char-2 0) -87) (the-as uint (* result 16)))
|
||||
)
|
||||
)
|
||||
(set!
|
||||
result
|
||||
(the-as
|
||||
int
|
||||
(+ (+ (-> next-char-2 0) -48) (the-as uint (shl result 4)))
|
||||
(+ (+ (-> next-char-2 0) -48) (the-as uint (* result 16)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -615,7 +615,7 @@
|
||||
)
|
||||
(set!
|
||||
result
|
||||
(the-as int (+ (+ (-> a0-4 0) -48) (the-as uint (shl result 1))))
|
||||
(the-as int (+ (+ (-> a0-4 0) -48) (the-as uint (* result 2))))
|
||||
)
|
||||
(set! a0-4 (&-> a0-4 1))
|
||||
)
|
||||
|
||||
@@ -515,7 +515,7 @@ TEST_F(FormRegressionTest, ExprDisasmVif) {
|
||||
std::string type = "(function (pointer vif-tag) int symbol symbol int)";
|
||||
std::string expected =
|
||||
"(let ((gp-0 0))\n"
|
||||
" (while (< gp-0 (shl arg1 2))\n"
|
||||
" (while (< gp-0 (* arg1 4))\n"
|
||||
" (let ((s0-0 4))\n"
|
||||
" (let ((s1-0 (-> arg0 0)))\n"
|
||||
" (format arg2 \" #x~X:\" arg0)\n"
|
||||
@@ -600,10 +600,7 @@ TEST_F(FormRegressionTest, ExprDisasmVif) {
|
||||
" ((= a0-12 6)\n"
|
||||
" (if (-> s1-0 imm)\n"
|
||||
" (set! s0-0 #x100000)\n"
|
||||
" (set!\n"
|
||||
" s0-0\n"
|
||||
" (the-as int (shl (the-as int (-> s1-0 imm)) 4))\n"
|
||||
" )\n"
|
||||
" (set! s0-0 (the-as int (* (-> s1-0 imm) 16)))\n"
|
||||
" )\n"
|
||||
" (format\n"
|
||||
" arg2\n"
|
||||
@@ -618,11 +615,11 @@ TEST_F(FormRegressionTest, ExprDisasmVif) {
|
||||
" (format\n"
|
||||
" arg2\n"
|
||||
" \" #x~X: #x~8x #x~8x #x~8x #x~8x~%\"\n"
|
||||
" (+ (+ (shl sv-48 4) 4) (the-as int arg0))\n"
|
||||
" (-> sv-32 (shl sv-48 2))\n"
|
||||
" (-> sv-32 (+ (shl sv-48 2) 1))\n"
|
||||
" (-> sv-32 (+ (shl sv-48 2) 2))\n"
|
||||
" (-> sv-32 (+ (shl sv-48 2) 3))\n"
|
||||
" (+ (+ (* sv-48 16) 4) (the-as int arg0))\n"
|
||||
" (-> sv-32 (* sv-48 4))\n"
|
||||
" (-> sv-32 (+ (* sv-48 4) 1))\n"
|
||||
" (-> sv-32 (+ (* sv-48 4) 2))\n"
|
||||
" (-> sv-32 (+ (* sv-48 4) 3))\n"
|
||||
" )\n"
|
||||
" (set! sv-48 (+ sv-48 1))\n"
|
||||
" )\n"
|
||||
@@ -692,7 +689,7 @@ TEST_F(FormRegressionTest, ExprDisasmVif) {
|
||||
" (&+! arg0 s0-0)\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (- gp-0 (shl arg1 2))\n"
|
||||
" (- gp-0 (* arg1 4))\n"
|
||||
" )";
|
||||
test_with_expr(func, type, expected, false, "",
|
||||
{{"L139", " #x~X:"},
|
||||
|
||||
@@ -422,7 +422,7 @@ TEST_F(FormRegressionTest, ExprSizeOfType) {
|
||||
" daddiu sp, sp, 16";
|
||||
std::string type = "(function type uint)";
|
||||
|
||||
std::string expected = "(logand (l.d L346) (+ (shl (-> arg0 allocated-length) 2) 43))";
|
||||
std::string expected = "(logand (l.d L346) (+ (* (-> arg0 allocated-length) 4) 43))";
|
||||
test_with_expr(func, type, expected, false, "");
|
||||
}
|
||||
|
||||
@@ -2610,9 +2610,9 @@ TEST_F(FormRegressionTest, QMemCpy) {
|
||||
std::string type = "(function pointer pointer int pointer)";
|
||||
std::string expected =
|
||||
"(let ((v0-0 arg0))\n"
|
||||
" (let* ((v1-1 (sar (+ arg2 15) 4))\n"
|
||||
" (a0-1 (&+ arg0 (shl v1-1 4)))\n"
|
||||
" (a1-1 (&+ arg1 (shl v1-1 4)))\n"
|
||||
" (let* ((v1-1 (/ (+ arg2 15) 16))\n"
|
||||
" (a0-1 (&+ arg0 (* v1-1 16)))\n"
|
||||
" (a1-1 (&+ arg1 (* v1-1 16)))\n"
|
||||
" )\n"
|
||||
" (while (nonzero? v1-1)\n"
|
||||
" (+! v1-1 -1)\n"
|
||||
@@ -2911,8 +2911,8 @@ TEST_F(FormRegressionTest, AshPropagation) {
|
||||
std::string expected =
|
||||
"(begin\n"
|
||||
" (set!\n"
|
||||
" (-> arg0 bytes (sar arg1 3))\n"
|
||||
" (logior (-> arg0 bytes (sar arg1 3)) (the-as uint (ash 1 (logand arg1 7))))\n"
|
||||
" (-> arg0 bytes (/ arg1 8))\n"
|
||||
" (logior (-> arg0 bytes (/ arg1 8)) (the-as uint (ash 1 (logand arg1 7))))\n"
|
||||
" )\n"
|
||||
" 0\n"
|
||||
" )";
|
||||
@@ -2947,7 +2947,7 @@ TEST_F(FormRegressionTest, AshPropagation2) {
|
||||
" daddu sp, sp, r0";
|
||||
std::string type = "(function bit-array int symbol)";
|
||||
std::string expected =
|
||||
"(let ((v1-2 (-> arg0 bytes (sar arg1 3))))\n"
|
||||
"(let ((v1-2 (-> arg0 bytes (/ arg1 8))))\n"
|
||||
" (nonzero? (logand v1-2 (the-as uint (ash 1 (logand arg1 7)))))\n"
|
||||
" )";
|
||||
test_with_expr(func, type, expected);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -2374,7 +2374,7 @@ TEST_F(FormRegressionTest, ExprStringToInt) {
|
||||
" )\n"
|
||||
" (set!\n"
|
||||
" v0-0\n"
|
||||
" (the-as int (+ (+ (-> a0-3 0) -55) (the-as uint (shl v0-0 4))))\n"
|
||||
" (the-as int (+ (+ (-> a0-3 0) -55) (the-as uint (* v0-0 16))))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (else\n"
|
||||
@@ -2385,11 +2385,11 @@ TEST_F(FormRegressionTest, ExprStringToInt) {
|
||||
" )\n"
|
||||
" (set!\n"
|
||||
" v0-0\n"
|
||||
" (the-as int (+ (+ (-> a0-3 0) -87) (the-as uint (shl v0-0 4))))\n"
|
||||
" (the-as int (+ (+ (-> a0-3 0) -87) (the-as uint (* v0-0 16))))\n"
|
||||
" )\n"
|
||||
" (set!\n"
|
||||
" v0-0\n"
|
||||
" (the-as int (+ (+ (-> a0-3 0) -48) (the-as uint (shl v0-0 4))))\n"
|
||||
" (the-as int (+ (+ (-> a0-3 0) -48) (the-as uint (* v0-0 16))))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
@@ -2407,7 +2407,7 @@ TEST_F(FormRegressionTest, ExprStringToInt) {
|
||||
" )\n"
|
||||
" (set!\n"
|
||||
" v0-0\n"
|
||||
" (the-as int (+ (+ (-> a0-4 0) -48) (the-as uint (shl v0-0 1))))\n"
|
||||
" (the-as int (+ (+ (-> a0-4 0) -48) (the-as uint (* v0-0 2))))\n"
|
||||
" )\n"
|
||||
" (set! a0-4 (&-> a0-4 1))\n"
|
||||
" )\n"
|
||||
|
||||
@@ -2591,10 +2591,10 @@ TEST_F(FormRegressionTest, ExprMethod16DeadPoolHeap) {
|
||||
" )\n"
|
||||
" )\n"
|
||||
" ((< f0-2 (l.f L347))\n"
|
||||
" (set! arg1 (shl arg1 2))\n"
|
||||
" (set! arg1 (* arg1 4))\n"
|
||||
" )\n"
|
||||
" ((< f0-2 (l.f L348))\n"
|
||||
" (set! arg1 (shl arg1 1))\n"
|
||||
" (set! arg1 (* arg1 2))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
(format #t "~x ~x~%" (* 2 #x80000001) (* #x80000001 2))
|
||||
(format #t "~x ~x~%" (* 2 #x80000000) (* #x80000000 2))
|
||||
(format #t "~x ~d ~x ~d~%" (/ (the uint -10) 3) (/ -10 3) (/ (the uint -10) 2) (/ -10 2))
|
||||
@@ -714,6 +714,14 @@ TEST_F(WithGameTests, Matrix) {
|
||||
"0\n"});
|
||||
}
|
||||
|
||||
TEST_F(WithGameTests, WeirdMultiply) {
|
||||
runner.run_static_test(env, testCategory, "test-weird-multiplies.gc",
|
||||
{"2 100000002\n"
|
||||
"100000000 100000000\n"
|
||||
"55555552 -3 7ffffffffffffffb -5\n"
|
||||
"0\n"});
|
||||
}
|
||||
|
||||
TEST(TypeConsistency, TypeConsistency) {
|
||||
Compiler compiler;
|
||||
compiler.enable_throw_on_redefines();
|
||||
|
||||
@@ -131,4 +131,13 @@ TEST(CommonUtil, FloatToString) {
|
||||
EXPECT_EQ("1460961.2", float_to_string(1460961.25));
|
||||
EXPECT_EQ("1460961.2", float_to_string(1460961.20));
|
||||
EXPECT_EQ("1460961.2", float_to_string(1460961.30));
|
||||
}
|
||||
|
||||
TEST(CommonUtil, PowerOfTwo) {
|
||||
EXPECT_EQ(get_power_of_two(0), std::nullopt);
|
||||
EXPECT_EQ(get_power_of_two(1), 0);
|
||||
EXPECT_EQ(get_power_of_two(2), 1);
|
||||
EXPECT_EQ(get_power_of_two(3), std::nullopt);
|
||||
EXPECT_EQ(get_power_of_two(4), 2);
|
||||
EXPECT_EQ(get_power_of_two(u64(1) << 63), 63);
|
||||
}
|
||||
Reference in New Issue
Block a user