jak-project/test/goalc/source_templates/with_game/test-vector-math-sqrt.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

22 lines
572 B
Common Lisp

(defun test-vector-sqrt ()
(let ((vector-in-1 (new 'stack 'vector))
(vector-out (new 'stack 'vector)))
(set-vector! vector-in-1 {{ v1x }} {{ v1y }} {{ v1z }} {{ v1w }})
(set-vector! vector-out {{ destx }} {{ desty }} {{ destz }} {{ destw }})
(rlet ((vf1 :class vf :reset-here #t)
(vf2 :class vf :reset-here #t))
(.lvf vf1 vector-in-1)
(.lvf vf2 vector-out)
({{ operation }} vf2 vf1 :ftf #b{{ ftf }})
(.wait.vf)
(.svf vector-out vf2))
(format #t "~f~%" (-> vector-out x))))
(test-vector-sqrt)