THREAD: [PPC] square rooting in powerpc
  1. 05-06-2015, 02:30 AM
    425
    Posts
    11,748
    Reputation
    Sep 2012
    NextGenUpdate
    hi ngu Smile lots of people are starting to learn ppc, and alot dont know about certin instructions/methods.
    anyways to square root in ppc you can use 'sqrts' for a double, or 'fsqrts' for floats.
    the params for both are: sqrts RD,RS. fsqrts FD,FS (RD/FD = Destination, RS/FS = Source)
    example:

    lis %r5,0x200
    lfs %f1,0x20(%r5)
    fsqrts %f2,%f1
    stfs %f2,0x30(%r5)

    c++ (sprx) example

    float sqrt(float flt)
    {
    *(float*)(0x2100000 + 0x10) = flt;
    __asm("lis %r5,0x210;"
    "lfs %f1,0x10(%r5);"
    "fsqrts %f1,%f1;"
    "stfs %f1,0x00(%r5);");
    return *(float*)0x2100000;
    }

    hope this helped Happy
  2. The Following 5 Users Say Thank You to milky4444 For This Useful Post:

    , , , ,

  3. 05-06-2015, 10:36 AM
    Swaqq's Avatar
    Swaqq
    Professional Thanker
    Swaqq's Avatar
    Swaqq
    Professional Thanker
    800
    Posts
    17,059
    Reputation
    Nov 2013
    NextGenUpdate
    obviously fake, we both know that lfs means last fucker standing. fake, rat, dont download. Thats all I will say.
  4. 05-06-2015, 11:28 AM
    Coffee Bean's Avatar
    Coffee Bean
    Cake is a lie
    Coffee Bean's Avatar
    Coffee Bean
    Cake is a lie
    3,236
    Posts
    0
    Reputation
    Feb 2015
    NextGenUpdate
    Originally Posted by milky4444 View Post
    hi ngu Smile lots of people are starting to learn ppc, and alot dont know about certin instructions/methods.
    anyways to square root in ppc you can use 'sqrts' for a double, or 'fsqrts' for floats.
    the params for both are: sqrts RD,RS. fsqrts FD,FS (RD/FD = Destination, RS/FS = Source)
    example:

    lis %r5,0x200
    lfs %f1,0x20(%r5)
    fsqrts %f2,%f1
    stfs %f2,0x30(%r5)

    c++ (sprx) example

    float sqrt(float flt)
    {
    *(float*)(0x2100000 + 0x10) = flt;
    __asm("lis %r5,0x210;"
    "lfs %f1,0x10(%r5);"
    "fsqrts %f1,%f1;"
    "stfs %f1,0x00(%r5);");
    return *(float*)0x2100000;
    }

    hope this helped Happy


    Thanks man Happy
  5. 05-07-2015, 08:54 PM
    425
    Posts
    11,748
    Reputation
    Sep 2012
    NextGenUpdate
    Originally Posted by Swaqq View Post
    obviously fake, we both know that lfs means last fucker standing. fake, rat, dont download. Thats all I will say.


    actually means Listen For Santa
  6. 05-09-2015, 12:03 PM
    Swaqq's Avatar
    Swaqq
    Professional Thanker
    Swaqq's Avatar
    Swaqq
    Professional Thanker
    800
    Posts
    17,059
    Reputation
    Nov 2013
    NextGenUpdate
    Originally Posted by milky4444 View Post
    actually means listen for santa


    no, it means lag for sluts!