Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect vector+! and a few other common inlined vector ops #636

Closed
5 of 6 tasks
water111 opened this issue Jun 27, 2021 · 5 comments
Closed
5 of 6 tasks

Detect vector+! and a few other common inlined vector ops #636

water111 opened this issue Jun 27, 2021 · 5 comments

Comments

@water111
Copy link
Collaborator

water111 commented Jun 27, 2021

There's also one with a multiply in there.

  • vector-!
  • vector+!
  • vector-reset!
  • vector-float*!
  • vector-dot 3
  • vector-dot 4
@water111
Copy link
Collaborator Author

water111 commented Jun 27, 2021

All but vector-float*! are implemented in #637. But I'm starting to think that there's a better way for some of these that detects at the instruction level.

    lqc2 vf1, 0(gC)
    mfc1 gD, fA
    qmtc2.i vf2, gD
    vaddx.w vf1, vf0, vf0
    vmulx.xyz vf1, vf1, vf2
    sqc2 vf1, 0(gE)

where:

fA = float in
gC = vector in
gD = temp
gE = vector out

It will make propagating in the float much easier in vector-float*!, and I think will reduce the chances of a bug in the propagation logic (currently it might be possible for the arguments to vector+! to be evaluated in the wrong order).

vector-reset! should stay as it is though.

@water111
Copy link
Collaborator Author

Now vector+!, vector-!, vector-float*!, and vector-dot! (3) all are recognized at the instruction level and it works well.

It looks like vector-cross is sometimes inlined, but not always. We should find if this is actually another function being inlined or not, and support it in a similar way.

I haven't seen any examples of vector-dot 4 yet, so I'm not going to worry about that for now.

@water111
Copy link
Collaborator Author

vector dot 4 is in baseplat. https://github.com/xTVaser/jak-project/tree/decomp/plat

@water111
Copy link
Collaborator Author

vector 3 is not working in camera.gc, likely because of stack variables.

@water111
Copy link
Collaborator Author

water111 commented Sep 1, 2021

vector4-dot added in #803.
I think supporting vector ops which involve stack spills is not worth the effort. We detect dot products by looking at instructions and it would be a lot of work to move this to later.

The others have been working extremely well, no issues so far.

@water111 water111 closed this as completed Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant