mirror of
https://github.com/open-goal/jak-project
synced 2026-09-08 20:02:39 -04:00
Support 128-bit variables (#336)
* wip 128 bit support * add a few more files to offline test
This commit is contained in:
@@ -146,7 +146,8 @@ std::unique_ptr<FormRegressionTest::TestData> FormRegressionTest::make_function(
|
||||
fmt::print("CFG:\n{}\n", test->func.cfg->to_dot());
|
||||
}
|
||||
|
||||
auto ops = convert_function_to_atomic_ops(test->func, program.labels);
|
||||
DecompWarnings warnings;
|
||||
auto ops = convert_function_to_atomic_ops(test->func, program.labels, warnings);
|
||||
test->func.ir2.atomic_ops = std::make_shared<FunctionAtomicOps>(std::move(ops));
|
||||
test->func.ir2.atomic_ops_succeeded = true;
|
||||
test->func.ir2.env.set_end_var(test->func.ir2.atomic_ops->end_op().return_var());
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for symbol EulSafe, type (array int32)
|
||||
(define
|
||||
EulSafe
|
||||
(the-as (array int32) (new 'static 'boxed-array int32 4 0 1 2 0))
|
||||
)
|
||||
|
||||
;; definition for symbol EulNext, type (array int32)
|
||||
(define
|
||||
EulNext
|
||||
(the-as (array int32) (new 'static 'boxed-array int32 4 1 2 0 1))
|
||||
)
|
||||
|
||||
;; definition of type euler-angles
|
||||
(deftype euler-angles (vector)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; definition for method 3 of type euler-angles
|
||||
;; Used lq/sq
|
||||
(defmethod inspect euler-angles ((obj euler-angles))
|
||||
(format #t "[~8x] ~A~%" obj 'euler-angles)
|
||||
(format #t "~Tdata[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tx: ~f~%" (-> obj data 0))
|
||||
(format #t "~Ty: ~f~%" (-> obj data 1))
|
||||
(format #t "~Tz: ~f~%" (-> obj data 2))
|
||||
(format #t "~Tw: ~f~%" (-> obj data 3))
|
||||
(format #t "~Tquad: ~D~%" (-> obj quad))
|
||||
obj
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-1 0))
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(none)
|
||||
|
||||
@@ -626,9 +626,8 @@
|
||||
)
|
||||
|
||||
;; definition for method 2 of type array
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; Used lq/sq
|
||||
(defmethod print array ((obj array))
|
||||
(local-vars (a2-8 int))
|
||||
(format #t "#(")
|
||||
(if (type-type? (-> obj content-type) integer)
|
||||
(let ((content-type-sym (-> obj content-type symbol)))
|
||||
@@ -717,19 +716,11 @@
|
||||
(cond
|
||||
((or (= content-type-sym 'uint128) (= content-type-sym 'int128))
|
||||
(dotimes (s5-8 (-> obj length))
|
||||
(let ((t9-10 format)
|
||||
(a0-21 #t)
|
||||
(a1-11 (if (zero? s5-8)
|
||||
"#x~X"
|
||||
" #x~X"
|
||||
)
|
||||
)
|
||||
)
|
||||
(let
|
||||
((v1-42 (+ (shl s5-8 4) (the-as int (the-as (array uint128) obj)))))
|
||||
(TODO.LQ a2-8 v1-42 :offset 12)
|
||||
)
|
||||
(t9-10 a0-21 a1-11 a2-8)
|
||||
(format #t (if (zero? s5-8)
|
||||
"#x~X"
|
||||
" #x~X"
|
||||
)
|
||||
(-> (the-as (array uint128) obj) s5-8)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -771,9 +762,8 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type array
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; Used lq/sq
|
||||
(defmethod inspect array ((obj array))
|
||||
(local-vars (a3-10 int))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tallocated-length: ~D~%" (-> obj allocated-length))
|
||||
(format #t "~Tlength: ~D~%" (-> obj length))
|
||||
@@ -826,15 +816,11 @@
|
||||
(cond
|
||||
((or (= content-type-sym 'int128) (= content-type-sym 'uint128))
|
||||
(dotimes (s5-8 (-> obj length))
|
||||
(let ((t9-14 format)
|
||||
(a0-25 #t)
|
||||
(a1-15 "~T [~D] #x~X~%")
|
||||
(a2-13 s5-8)
|
||||
)
|
||||
(let ((v1-42 (+ (shl s5-8 4) (the-as int obj))))
|
||||
(TODO.LQ a3-10 v1-42 :offset 12)
|
||||
)
|
||||
(t9-14 a0-25 a1-15 a2-13 a3-10)
|
||||
(format
|
||||
#t
|
||||
"~T [~D] #x~X~%"
|
||||
s5-8
|
||||
(-> (the-as (pointer uint128) (+ (shl s5-8 4) (the-as int obj))))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -900,16 +886,16 @@
|
||||
)
|
||||
|
||||
;; definition for function qmem-copy<-!
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.SQ]
|
||||
;; Used lq/sq
|
||||
(defun qmem-copy<-! ((dst pointer) (src pointer) (size int))
|
||||
(local-vars (value int))
|
||||
(let ((result dst))
|
||||
(let ((qwc (sar (+ size 15) 4)))
|
||||
(while (nonzero? qwc)
|
||||
(+! qwc -1)
|
||||
(TODO.LQ value src)
|
||||
(TODO.SQ value dst)
|
||||
(set!
|
||||
(-> (the-as (pointer uint128) dst))
|
||||
(-> (the-as (pointer uint128) src))
|
||||
)
|
||||
(&+! dst 16)
|
||||
(&+! src 16)
|
||||
)
|
||||
@@ -919,21 +905,21 @@
|
||||
)
|
||||
|
||||
;; definition for function qmem-copy->!
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.SQ]
|
||||
;; Used lq/sq
|
||||
(defun qmem-copy->! ((dst pointer) (src pointer) (size int))
|
||||
(local-vars (value int))
|
||||
(let ((result dst))
|
||||
(let* ((qwc (sar (+ size 15) 4))
|
||||
(src-ptr (&+ dst (shl qwc 4)))
|
||||
(dst-ptr (&+ src (shl qwc 4)))
|
||||
(dst-ptr (&+ dst (shl qwc 4)))
|
||||
(src-ptr (&+ src (shl qwc 4)))
|
||||
)
|
||||
(while (nonzero? qwc)
|
||||
(+! qwc -1)
|
||||
(&+! src-ptr -16)
|
||||
(&+! dst-ptr -16)
|
||||
(TODO.LQ value dst-ptr)
|
||||
(TODO.SQ value src-ptr)
|
||||
(&+! src-ptr -16)
|
||||
(set!
|
||||
(-> (the-as (pointer uint128) dst-ptr))
|
||||
(-> (the-as (pointer uint128) src-ptr))
|
||||
)
|
||||
)
|
||||
)
|
||||
result
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition of type curve
|
||||
(deftype curve (structure)
|
||||
((cverts uint32 :offset-assert 0)
|
||||
(num-cverts int32 :offset-assert 4)
|
||||
(knots uint32 :offset-assert 8)
|
||||
(num-knots int32 :offset-assert 12)
|
||||
(length float :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x14
|
||||
:flag-assert #x900000014
|
||||
)
|
||||
|
||||
;; definition for method 3 of type curve
|
||||
(defmethod inspect curve ((obj curve))
|
||||
(format #t "[~8x] ~A~%" obj 'curve)
|
||||
(format #t "~Tcverts: #x~X~%" (-> obj cverts))
|
||||
(format #t "~Tnum-cverts: ~D~%" (-> obj num-cverts))
|
||||
(format #t "~Tknots: #x~X~%" (-> obj knots))
|
||||
(format #t "~Tnum-knots: ~D~%" (-> obj num-knots))
|
||||
(format #t "~Tlength: ~f~%" (-> obj length))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type border-plane
|
||||
(deftype border-plane (basic)
|
||||
((name basic :offset-assert 4)
|
||||
(action basic :offset-assert 8)
|
||||
(slot int8 :offset-assert 12)
|
||||
(trans vector :inline :offset-assert 16)
|
||||
(normal vector :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 11
|
||||
:size-assert #x30
|
||||
:flag-assert #xb00000030
|
||||
(:methods
|
||||
(dummy-9 () none 9)
|
||||
(dummy-10 () none 10)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type border-plane
|
||||
(defmethod inspect border-plane ((obj border-plane))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tname: ~A~%" (-> obj name))
|
||||
(format #t "~Taction: ~A~%" (-> obj action))
|
||||
(format #t "~Tslot: ~D~%" (-> obj slot))
|
||||
(format #t "~Ttrans: ~`vector`P~%" (-> obj trans))
|
||||
(format #t "~Tnormal: ~`vector`P~%" (-> obj normal))
|
||||
obj
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-2 0))
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(none)
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition of type matrix
|
||||
(deftype matrix (structure)
|
||||
((data float 16 :offset-assert 0)
|
||||
(vector vector 4 :inline :offset 0)
|
||||
(quad uint128 4 :offset 0)
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x40
|
||||
:flag-assert #xa00000040
|
||||
(:methods
|
||||
(dummy-9 () none 9)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type matrix
|
||||
(defmethod inspect matrix ((obj matrix))
|
||||
(format #t "[~8x] ~A~%" obj 'matrix)
|
||||
(format #t "~Tdata[16] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tvector[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tquad[4] @ #x~X~%" (-> obj data))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type matrix3
|
||||
(deftype matrix3 (structure)
|
||||
((data float 12 :offset-assert 0)
|
||||
(vector vector 3 :inline :offset 0)
|
||||
(quad uint128 3 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x30
|
||||
:flag-assert #x900000030
|
||||
)
|
||||
|
||||
;; definition for method 3 of type matrix3
|
||||
(defmethod inspect matrix3 ((obj matrix3))
|
||||
(format #t "[~8x] ~A~%" obj 'matrix3)
|
||||
(format #t "~Tdata[12] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tvector[3] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tquad[3] @ #x~X~%" (-> obj data))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type matrix4h
|
||||
(deftype matrix4h (structure)
|
||||
((data int16 16 :offset-assert 0)
|
||||
(vector4h vector4h 4 :inline :offset 0)
|
||||
(long int64 4 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
:flag-assert #x900000020
|
||||
)
|
||||
|
||||
;; definition for method 3 of type matrix4h
|
||||
(defmethod inspect matrix4h ((obj matrix4h))
|
||||
(format #t "[~8x] ~A~%" obj 'matrix4h)
|
||||
(format #t "~Tdata[16] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tvector4h[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tlong[4] @ #x~X~%" (-> obj data))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition for function matrix-copy!
|
||||
;; Used lq/sq
|
||||
(defun matrix-copy! ((arg0 matrix) (arg1 matrix))
|
||||
(let ((v1-0 (-> arg1 vector 0 quad))
|
||||
(a2-0 (-> arg1 vector 1 quad))
|
||||
(a3-0 (-> arg1 vector 2 quad))
|
||||
(a1-1 (-> arg1 vector 3 quad))
|
||||
)
|
||||
(set! (-> arg0 vector 0 quad) v1-0)
|
||||
(set! (-> arg0 vector 1 quad) a2-0)
|
||||
(set! (-> arg0 vector 2 quad) a3-0)
|
||||
(set! (-> arg0 vector 3 quad) a1-1)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(none)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition of type quaternion
|
||||
(deftype quaternion (structure)
|
||||
((data float 4 :offset-assert 0)
|
||||
(x float :offset 0)
|
||||
(y float :offset 4)
|
||||
(z float :offset 8)
|
||||
(w float :offset 12)
|
||||
(vec vector :inline :offset 0)
|
||||
(quad uint128 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; definition for method 3 of type quaternion
|
||||
;; Used lq/sq
|
||||
(defmethod inspect quaternion ((obj quaternion))
|
||||
(format #t "[~8x] ~A~%" obj 'quaternion)
|
||||
(format #t "~Tdata[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tx: ~f~%" (-> obj data 0))
|
||||
(format #t "~Ty: ~f~%" (-> obj data 1))
|
||||
(format #t "~Tz: ~f~%" (-> obj data 2))
|
||||
(format #t "~Tw: ~f~%" (-> obj data 3))
|
||||
(format #t "~Tvec: #<vector @ #x~X>~%" (-> obj data))
|
||||
(format #t "~Tquad: ~D~%" (-> obj vec quad))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition for symbol *unity-quaternion*, type quaternion
|
||||
(define *unity-quaternion* (new 'static 'quaternion :w 1.0))
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-1 0))
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(none)
|
||||
@@ -0,0 +1,50 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition of type transform
|
||||
(deftype transform (structure)
|
||||
((trans vector :inline :offset-assert 0)
|
||||
(rot vector :inline :offset-assert 16)
|
||||
(scale vector :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x30
|
||||
:flag-assert #x900000030
|
||||
)
|
||||
|
||||
;; definition for method 3 of type transform
|
||||
(defmethod inspect transform ((obj transform))
|
||||
(format #t "[~8x] ~A~%" obj 'transform)
|
||||
(format #t "~Ttrans: ~`vector`P~%" (-> obj trans))
|
||||
(format #t "~Trot: ~`vector`P~%" (-> obj rot))
|
||||
(format #t "~Tscale: ~`vector`P~%" (-> obj scale))
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition of type trs
|
||||
(deftype trs (basic)
|
||||
((trans vector :inline :offset-assert 16)
|
||||
(rot vector :inline :offset-assert 32)
|
||||
(scale vector :inline :offset-assert 48)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x40
|
||||
:flag-assert #x900000040
|
||||
)
|
||||
|
||||
;; definition for method 3 of type trs
|
||||
(defmethod inspect trs ((obj trs))
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Ttrans: ~`vector`P~%" (-> obj trans))
|
||||
(format #t "~Trot: ~`vector`P~%" (-> obj rot))
|
||||
(format #t "~Tscale: ~`vector`P~%" (-> obj scale))
|
||||
obj
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-2 0))
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(none)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-0 0))
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(none)
|
||||
|
||||
@@ -282,9 +282,8 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type vector4w
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; Used lq/sq
|
||||
(defmethod inspect vector4w ((obj vector4w))
|
||||
(local-vars (a2-7 int))
|
||||
(format #t "[~8x] ~A~%" obj 'vector4w)
|
||||
(format #t "~Tdata[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tx: ~D~%" (-> obj data 0))
|
||||
@@ -292,13 +291,7 @@
|
||||
(format #t "~Tz: ~D~%" (-> obj data 2))
|
||||
(format #t "~Tw: ~D~%" (-> obj data 3))
|
||||
(format #t "~Tdword[2] @ #x~X~%" (-> obj data))
|
||||
(let ((t9-7 format)
|
||||
(a0-8 #t)
|
||||
(a1-7 "~Tquad: ~D~%")
|
||||
)
|
||||
(TODO.LQ a2-7 obj)
|
||||
(t9-7 a0-8 a1-7 a2-7)
|
||||
)
|
||||
(format #t "~Tquad: ~D~%" (-> obj quad))
|
||||
obj
|
||||
)
|
||||
|
||||
@@ -414,18 +407,11 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type vector8h
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; Used lq/sq
|
||||
(defmethod inspect vector8h ((obj vector8h))
|
||||
(local-vars (a2-2 int))
|
||||
(format #t "[~8x] ~A~%" obj 'vector8h)
|
||||
(format #t "~Tdata[8] @ #x~X~%" (-> obj data))
|
||||
(let ((t9-2 format)
|
||||
(a0-3 #t)
|
||||
(a1-2 "~Tquad: ~D~%")
|
||||
)
|
||||
(TODO.LQ a2-2 obj)
|
||||
(t9-2 a0-3 a1-2 a2-2)
|
||||
)
|
||||
(format #t "~Tquad: ~D~%" (-> obj quad))
|
||||
obj
|
||||
)
|
||||
|
||||
@@ -440,18 +426,11 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type vector16b
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; Used lq/sq
|
||||
(defmethod inspect vector16b ((obj vector16b))
|
||||
(local-vars (a2-2 int))
|
||||
(format #t "[~8x] ~A~%" obj 'vector16b)
|
||||
(format #t "~Tdata[8] @ #x~X~%" (-> obj data))
|
||||
(let ((t9-2 format)
|
||||
(a0-3 #t)
|
||||
(a1-2 "~Tquad: ~D~%")
|
||||
)
|
||||
(TODO.LQ a2-2 obj)
|
||||
(t9-2 a0-3 a1-2 a2-2)
|
||||
)
|
||||
(format #t "~Tquad: ~D~%" (-> obj quad))
|
||||
obj
|
||||
)
|
||||
|
||||
@@ -471,22 +450,15 @@
|
||||
|
||||
;; definition for method 3 of type vector
|
||||
;; INFO: this function exists in multiple non-identical object files
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; Used lq/sq
|
||||
(defmethod inspect vector ((obj vector))
|
||||
(local-vars (a2-6 int))
|
||||
(format #t "[~8x] ~A~%" obj 'vector)
|
||||
(format #t "~Tdata[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tx: ~f~%" (-> obj data 0))
|
||||
(format #t "~Ty: ~f~%" (-> obj data 1))
|
||||
(format #t "~Tz: ~f~%" (-> obj data 2))
|
||||
(format #t "~Tw: ~f~%" (-> obj data 3))
|
||||
(let ((t9-6 format)
|
||||
(a0-7 #t)
|
||||
(a1-6 "~Tquad: ~D~%")
|
||||
)
|
||||
(TODO.LQ a2-6 obj)
|
||||
(t9-6 a0-7 a1-6 a2-6)
|
||||
)
|
||||
(format #t "~Tquad: ~D~%" (-> obj quad))
|
||||
obj
|
||||
)
|
||||
|
||||
@@ -590,22 +562,15 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type rgbaf
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; Used lq/sq
|
||||
(defmethod inspect rgbaf ((obj rgbaf))
|
||||
(local-vars (a2-6 int))
|
||||
(format #t "[~8x] ~A~%" obj 'rgbaf)
|
||||
(format #t "~Tdata[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tx: ~f~%" (-> obj data 0))
|
||||
(format #t "~Ty: ~f~%" (-> obj data 1))
|
||||
(format #t "~Tz: ~f~%" (-> obj data 2))
|
||||
(format #t "~Tw: ~f~%" (-> obj data 3))
|
||||
(let ((t9-6 format)
|
||||
(a0-7 #t)
|
||||
(a1-6 "~Tquad: ~D~%")
|
||||
)
|
||||
(TODO.LQ a2-6 obj)
|
||||
(t9-6 a0-7 a1-6 a2-6)
|
||||
)
|
||||
(format #t "~Tquad: ~D~%" (-> obj quad))
|
||||
(format #t "~Tr: ~f~%" (-> obj data 0))
|
||||
(format #t "~Tg: ~f~%" (-> obj data 1))
|
||||
(format #t "~Tb: ~f~%" (-> obj data 2))
|
||||
@@ -626,22 +591,15 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type plane
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; Used lq/sq
|
||||
(defmethod inspect plane ((obj plane))
|
||||
(local-vars (a2-6 int))
|
||||
(format #t "[~8x] ~A~%" obj 'plane)
|
||||
(format #t "~Tdata[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tx: ~f~%" (-> obj data 0))
|
||||
(format #t "~Ty: ~f~%" (-> obj data 1))
|
||||
(format #t "~Tz: ~f~%" (-> obj data 2))
|
||||
(format #t "~Tw: ~f~%" (-> obj data 3))
|
||||
(let ((t9-6 format)
|
||||
(a0-7 #t)
|
||||
(a1-6 "~Tquad: ~D~%")
|
||||
)
|
||||
(TODO.LQ a2-6 obj)
|
||||
(t9-6 a0-7 a1-6 a2-6)
|
||||
)
|
||||
(format #t "~Tquad: ~D~%" (-> obj quad))
|
||||
(format #t "~Ta: ~f~%" (-> obj data 0))
|
||||
(format #t "~Tb: ~f~%" (-> obj data 1))
|
||||
(format #t "~Tc: ~f~%" (-> obj data 2))
|
||||
@@ -659,22 +617,15 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type sphere
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; Used lq/sq
|
||||
(defmethod inspect sphere ((obj sphere))
|
||||
(local-vars (a2-6 int))
|
||||
(format #t "[~8x] ~A~%" obj 'sphere)
|
||||
(format #t "~Tdata[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tx: ~f~%" (-> obj data 0))
|
||||
(format #t "~Ty: ~f~%" (-> obj data 1))
|
||||
(format #t "~Tz: ~f~%" (-> obj data 2))
|
||||
(format #t "~Tw: ~f~%" (-> obj data 3))
|
||||
(let ((t9-6 format)
|
||||
(a0-7 #t)
|
||||
(a1-6 "~Tquad: ~D~%")
|
||||
)
|
||||
(TODO.LQ a2-6 obj)
|
||||
(t9-6 a0-7 a1-6 a2-6)
|
||||
)
|
||||
(format #t "~Tquad: ~D~%" (-> obj quad))
|
||||
(format #t "~Tr: ~f~%" (-> obj data 3))
|
||||
obj
|
||||
)
|
||||
@@ -834,22 +785,15 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type qword
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; Used lq/sq
|
||||
(defmethod inspect qword ((obj qword))
|
||||
(local-vars (a2-6 int))
|
||||
(format #t "[~8x] ~A~%" obj 'qword)
|
||||
(format #t "~Tdata[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tbyte[16] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Thword[8] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tword[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tdword[2] @ #x~X~%" (-> obj data))
|
||||
(let ((t9-6 format)
|
||||
(a0-7 #t)
|
||||
(a1-6 "~Tquad: ~D~%")
|
||||
)
|
||||
(TODO.LQ a2-6 obj)
|
||||
(t9-6 a0-7 a1-6 a2-6)
|
||||
)
|
||||
(format #t "~Tquad: ~D~%" (-> obj quad))
|
||||
(format #t "~Tvector: #<vector @ #x~X>~%" (-> obj data))
|
||||
(format #t "~Tvector4w: #<vector4w @ #x~X>~%" (-> obj data))
|
||||
obj
|
||||
@@ -999,10 +943,9 @@
|
||||
)
|
||||
|
||||
;; definition for function vector-zero!
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.SQ]
|
||||
;; Used lq/sq
|
||||
(defun vector-zero! ((arg0 vector))
|
||||
(local-vars (r0-0 none))
|
||||
(TODO.SQ r0-0 arg0)
|
||||
(set! (-> arg0 quad) (the-as uint128 0))
|
||||
arg0
|
||||
)
|
||||
|
||||
@@ -1016,12 +959,9 @@
|
||||
)
|
||||
|
||||
;; definition for function vector-copy!
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.LQ]
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.SQ]
|
||||
;; Used lq/sq
|
||||
(defun vector-copy! ((arg0 vector) (arg1 vector))
|
||||
(local-vars (v1-0 int))
|
||||
(TODO.LQ v1-0 arg1)
|
||||
(TODO.SQ v1-0 arg0)
|
||||
(set! (-> arg0 quad) (-> arg1 quad))
|
||||
arg0
|
||||
)
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include <regex>
|
||||
#include "gtest/gtest.h"
|
||||
#include "decompiler/IR2/AtomicOp.h"
|
||||
#include "decompiler/analysis/atomic_op_builder.h"
|
||||
#include "decompiler/Disasm/InstructionParser.h"
|
||||
#include "third-party/fmt/core.h"
|
||||
#include "third-party/fmt/format.h"
|
||||
#include <regex>
|
||||
#include "decompiler/Function/Warnings.h"
|
||||
|
||||
using namespace decompiler;
|
||||
|
||||
@@ -42,8 +43,9 @@ void test_case(std::string assembly_lines,
|
||||
FunctionAtomicOps container;
|
||||
|
||||
// treat the entire program as a single basic block, and convert!
|
||||
DecompWarnings warnings;
|
||||
convert_block_to_atomic_ops(0, prg.instructions.begin(), prg.instructions.end(), prg.labels,
|
||||
&container);
|
||||
&container, warnings);
|
||||
|
||||
// count operations
|
||||
EXPECT_EQ(container.ops.size(), output_lines.size());
|
||||
@@ -126,8 +128,9 @@ TEST(DecompilerAtomicOpBuilder, RegUseDuplication) {
|
||||
ParsedProgram prg = parser.parse_program(assembly);
|
||||
EXPECT_EQ(prg.print(), assembly);
|
||||
FunctionAtomicOps container;
|
||||
DecompWarnings warnings;
|
||||
convert_block_to_atomic_ops(0, prg.instructions.begin(), prg.instructions.end(), prg.labels,
|
||||
&container);
|
||||
&container, warnings);
|
||||
ASSERT_EQ(1, container.ops.size());
|
||||
auto& op = container.ops.at(0);
|
||||
for (const auto& reg_group : {op->read_regs(), op->write_regs(), op->clobber_regs()}) {
|
||||
|
||||
@@ -2618,8 +2618,10 @@ TEST_F(FormRegressionTest, QMemCpy) {
|
||||
" (+! v1-1 -1)\n"
|
||||
" (&+! a0-1 -16)\n"
|
||||
" (&+! a1-1 -16)\n"
|
||||
" (.lq a2-3 0 a1-1)\n"
|
||||
" (.sq a2-3 0 a0-1)\n"
|
||||
" (set!\n"
|
||||
" (-> (the-as (pointer uint128) a0-1))\n"
|
||||
" (-> (the-as (pointer uint128) a1-1))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" v0-0\n"
|
||||
|
||||
@@ -627,18 +627,15 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
|
||||
" (else\n"
|
||||
" (cond\n"
|
||||
" ((or (= v1-1 (quote uint128)) (= v1-1 (quote int128)))\n"
|
||||
" (dotimes\n"
|
||||
" (s5-8 (-> arg0 length))\n"
|
||||
" (let\n"
|
||||
" ((t9-10 format) (a0-21 #t) (a1-11 (if (zero? s5-8) \"#x~X\" \" #x~X\")))\n"
|
||||
" (let\n"
|
||||
" ((v1-42 (+ (shl s5-8 4) (the-as int (the-as (array uint128) arg0)))))\n"
|
||||
" (.lq a2-8 12 v1-42)\n"
|
||||
" )\n"
|
||||
" (t9-10 a0-21 a1-11 a2-8)\n"
|
||||
" (dotimes (s5-8 (-> arg0 length))\n"
|
||||
" (format #t (if (zero? s5-8)\n"
|
||||
" \"#x~X\"\n"
|
||||
" \" #x~X\"\n"
|
||||
" )\n"
|
||||
" (-> (the-as (array uint128) arg0) s5-8)\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )"
|
||||
" (else\n"
|
||||
" (dotimes\n"
|
||||
" (s5-9 (-> arg0 length))\n"
|
||||
@@ -1223,18 +1220,15 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
|
||||
" (else\n"
|
||||
" (cond\n"
|
||||
" ((or (= v1-1 (quote int128)) (= v1-1 (quote uint128)))\n"
|
||||
" (dotimes\n"
|
||||
" (s5-8 (-> arg0 length))\n"
|
||||
" (let\n"
|
||||
" ((t9-14 format) (a0-25 #t) (a1-15 \"~T [~D] #x~X~%\") (a2-13 s5-8))\n"
|
||||
" (let\n"
|
||||
" ((v1-42 (+ (shl s5-8 4) (the-as int (the-as (array uint128) arg0)))))\n"
|
||||
" (.lq a3-10 12 v1-42)\n"
|
||||
" )\n"
|
||||
" (t9-14 a0-25 a1-15 a2-13 a3-10)\n"
|
||||
" (dotimes (s5-8 (-> arg0 length))\n"
|
||||
" (format\n"
|
||||
" #t\n"
|
||||
" \"~T [~D] #x~X~%\"\n"
|
||||
" s5-8\n"
|
||||
" (-> (the-as (array uint128) arg0) s5-8)\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )"
|
||||
" (else\n"
|
||||
" (dotimes\n"
|
||||
" (s5-9 (-> arg0 length))\n"
|
||||
|
||||
@@ -10,25 +10,35 @@
|
||||
|
||||
namespace {
|
||||
// the object files to test
|
||||
const std::unordered_set<std::string> g_object_files_to_decompile = {"gcommon",
|
||||
"gstring-h",
|
||||
"gkernel-h",
|
||||
"gkernel",
|
||||
/*"pskernel",*/ "gstring",
|
||||
"dgo-h",
|
||||
"gstate",
|
||||
"types-h",
|
||||
"vu1-macros",
|
||||
"math",
|
||||
"vector-h",
|
||||
"bounding-box-h",
|
||||
/* gap */ "bounding-box"};
|
||||
const std::unordered_set<std::string> g_object_files_to_decompile = {
|
||||
"gcommon", "gstring-h", "gkernel-h", "gkernel",
|
||||
/*"pskernel",*/ "gstring", "dgo-h", "gstate", "types-h", "vu1-macros", "math", "vector-h",
|
||||
"bounding-box-h", "matrix-h", "quaternion-h", "euler-h", "transform-h", "geometry-h",
|
||||
"trigonometry-h",
|
||||
/* gap */
|
||||
"bounding-box"};
|
||||
|
||||
// the object files to check against a reference in test/decompiler/reference
|
||||
const std::vector<std::string> g_object_files_to_check_against_reference = {
|
||||
"gcommon", // NOTE: this file needs work, but adding it for now just to test the framework.
|
||||
"gstring-h", "gkernel-h", "gkernel", "gstring", "dgo-h", "gstate",
|
||||
"types-h", "vu1-macros", "math", "vector-h", "bounding-box-h", /* gap */ "bounding-box"};
|
||||
"gstring-h",
|
||||
"gkernel-h",
|
||||
"gkernel",
|
||||
"gstring",
|
||||
"dgo-h",
|
||||
"gstate",
|
||||
"types-h",
|
||||
"vu1-macros",
|
||||
"math",
|
||||
"vector-h",
|
||||
"bounding-box-h",
|
||||
"matrix-h",
|
||||
"quaternion-h",
|
||||
"euler-h",
|
||||
"transform-h",
|
||||
"geometry-h",
|
||||
"trigonometry-h",
|
||||
/* gap */ "bounding-box"};
|
||||
|
||||
// the functions we expect the decompiler to skip
|
||||
const std::unordered_set<std::string> expected_skip_in_decompiler = {
|
||||
@@ -64,10 +74,8 @@ const std::unordered_set<std::string> skip_in_compiling = {
|
||||
"abs", "ash", "min", "max", "lognor",
|
||||
// weird PS2 specific debug registers:
|
||||
"breakpoint-range-set!",
|
||||
// these require 128-bit integers. We want these eventually, but disabling for now to focus
|
||||
// on more important issues.
|
||||
"(method 3 vec4s)", "(method 2 vec4s)", "qmem-copy<-!", "qmem-copy->!", "(method 2 array)",
|
||||
"(method 3 array)",
|
||||
// int128 fancy stuff.
|
||||
"(method 3 vec4s)", "(method 2 vec4s)",
|
||||
// does weird stuff with the type system.
|
||||
"print", "printl", "inspect",
|
||||
// inline assembly
|
||||
@@ -89,18 +97,9 @@ const std::unordered_set<std::string> skip_in_compiling = {
|
||||
"log2", // weird tricky int-as-float stuff
|
||||
|
||||
/// VECTOR-H
|
||||
"(method 3 vector4w)", // print quad
|
||||
"(method 3 vector8h)", // print quad
|
||||
"(method 3 vector16b)", // print quad
|
||||
"(method 3 vector)", // print quad
|
||||
"(method 3 rgbaf)", // print quad
|
||||
"(method 3 plane)", // print quad
|
||||
"(method 3 sphere)", // print quad
|
||||
"(method 3 qword)", // print quad
|
||||
"vector-zero!", // i128
|
||||
"vector-copy!", // i128
|
||||
"vector-dot", // fpu acc
|
||||
"vector4-dot", // fpu acc
|
||||
"(method 3 vector)", // this function appears twice, which confuses the compiler.
|
||||
"vector-dot", // fpu acc
|
||||
"vector4-dot", // fpu acc
|
||||
};
|
||||
|
||||
// default location for the data. It can be changed with a command line argument.
|
||||
|
||||
Reference in New Issue
Block a user