mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
65206823ef
* A little project cleanup * Script to grep decompiler results * Compiler: Implement VNOP -> FNOP (.nop.vf) temp: test new addition * Compiler: Implement VMUL.xyzw (.mul.vf) squash: cleaning up files i don't want to accidentally stage * Compiler: Implement V[ADD|SUB|MUL].dest instructions * Compiler: Implement V[ADD|SUB|MUL][x|y|w|z].dest instructions * Compiler: Implement V[MIN|MAX]{[x|y|z|w]}.dest instructions * Compiler: Implement V[ABS]{[x|y|z|w]}.dest instructions * Cleanup review feedback before adding tests and docs * Tests: Added missing emitter tests * tests/compiler: Comprehensively test all new instructions * docs: Add documentation for newly supported operations * Remove unused vector-h function * Address review feedback
24 lines
641 B
Common Lisp
24 lines
641 B
Common Lisp
(defun test-basic-vector-math ()
|
|
(let ((vector-0 (new 'stack 'vector))
|
|
(vector-1 (new 'stack 'vector))
|
|
(vector-2 (new 'stack 'vector)))
|
|
(set! (-> vector-0 x) 1.0)
|
|
(set! (-> vector-0 y) 2.0)
|
|
(set! (-> vector-0 z) 3.0)
|
|
(set! (-> vector-0 w) 4.0)
|
|
|
|
(set! (-> vector-1 x) 10.0)
|
|
(set! (-> vector-1 y) 20.0)
|
|
(set! (-> vector-1 z) 30.0)
|
|
(set! (-> vector-1 w) 40.1)
|
|
|
|
(.nop.vf)
|
|
(vector-! vector-2 vector-1 vector-0)
|
|
(.nop.vf)
|
|
; 9 + 18 + 27 = 54.0000
|
|
(format #t "~f~%" (+ (-> vector-2 x) (-> vector-2 y) (-> vector-2 z) (-> vector-2 w)))
|
|
)
|
|
)
|
|
|
|
(test-basic-vector-math)
|