jak-project/test/goalc/source_templates/with_game/test-vector-math-2-operand-acc.template.gc
Tyler Wilding cdce4d9612
compiler: Support the majority of the remaining VU VF instructions (#258)
* compiler: Support the majority of the remaining VU VF instructions

- VWAIT
- VMADD variants
- VMSUB variants
- VSQRT
- VDIV
- outer product (VOPMULA + VOPMSUB)

* compiler: Fix some bugs / optimize some instructions

* tests/compiler: Add test coverage for new instructions

* docs: Add documentation for new inline assembly functions

* lint: Formatting / fix failing test

* Remove my comment about ftf/fsf encoding, it's been fixed

* address review feedback

* correct VSQRTPS implementation
2021-02-16 21:41:33 -05:00

30 lines
1.1 KiB
Common Lisp

(defun test-vector-outer-product ()
(let ((vector-in-1 (new 'stack 'vector))
(vector-in-2 (new 'stack 'vector))
(vector-acc (new 'stack 'vector))
(vector-out (new 'stack 'vector)))
(set-vector! vector-in-1 {{ v1x }} {{ v1y }} {{ v1z }} {{ v1w }})
(set-vector! vector-in-2 {{ v2x }} {{ v2y }} {{ v2z }} {{ v2w }})
(set-vector! vector-acc {{ accx }} {{ accy }} {{ accz }} {{ accw }})
(set-vector! vector-out {{ destx }} {{ desty }} {{ destz }} {{ destw }})
(rlet ((vf1 :class vf :reset-here #t)
(vf2 :class vf :reset-here #t)
(vfd :class vf :reset-here #t)
(acc :class vf :reset-here #t))
(.lvf vfd vector-out)
(.lvf vf1 vector-in-1)
(.lvf vf2 vector-in-2)
(.lvf acc vector-acc)
({{ operation }} vfd vf1 vf2 acc{% if destinationMask %} :mask #b{{ destinationMask }}{% endif %})
(.wait.vf)
(.svf vector-out vfd))
(format #t "(~f, ~f, ~f, ~f)~%" (-> vector-out x) (-> vector-out y) (-> vector-out z) (-> vector-out w))))
(test-vector-outer-product)