PowerPC GCC floating point instructions












0















Currently I am developing for a MPC5777 board, with e200z7 cores. Most of the things are going well, but I am stuck with a problem that is really annoying me already.
I am trying to use floating point operations on portions of my code, using the embedded hardware support. My toolchain is GCC 6.3 (powerpc-gcc), for which I am using the following flags:



ASFLAGS_BASE = -g -a32 -mbooke -me500 --fatal-warnings

ARCH_FLAGS = -mpowerpc-gpopt -mfprnd -misel -m32 -mhard-float -mabi=spe -mmfpgpr -mfloat-gprs=single


Please notice the -mfloat-gprs=single flag. That is the one that is giving problems.



When I use -mfloat-gprs=single, I am not able to compile things properly, as some functions are not implemented:



undefined reference to `__extendsfdf2`,
undefined reference to `__adddf3`,
undefined reference to `__divdf3`,


- among others.



Now, if I compile using -mfloat-gprs=double, it goes till the end and generate all my execution files. BUT, using this flag also generates extra functions, not implemented by the e200z7. I can't tell for sure all of them, as the code is getting bigger and it is mostly impossible to track all generated assembly. For instance, at the moment my execution gets stuck when it reaches the efscfd instruction, which is implemented by the e500 core, that has double precision floating point support, but not for the e200, that has single precision support only.



So, any piece of advice here would be amazingly welcome!



Thanks in advance,










share|improve this question

























  • The doc for -mfloat-gprs says "This option is currently only available on the MPC854x."

    – Marc Glisse
    Nov 21 '18 at 20:52











  • Hey Marc, indeed it says. still, it works. I have two "architectures": the board I am working on and qemu. QeMU emulates an e500 core and the board has two e200z7 cores. I have to set the flags individually for each one of them, and the -mfloat-gprs affects directly the outcome for both. In my opinion, the comments regarding this flag are legacy, and do not reflect newer GCC versions.

    – Felipe GM
    Nov 22 '18 at 18:10











  • You'll probably have to post to the gcc-help mailing list or create an issue on gcc's bugzilla...

    – Marc Glisse
    Nov 22 '18 at 18:13
















0















Currently I am developing for a MPC5777 board, with e200z7 cores. Most of the things are going well, but I am stuck with a problem that is really annoying me already.
I am trying to use floating point operations on portions of my code, using the embedded hardware support. My toolchain is GCC 6.3 (powerpc-gcc), for which I am using the following flags:



ASFLAGS_BASE = -g -a32 -mbooke -me500 --fatal-warnings

ARCH_FLAGS = -mpowerpc-gpopt -mfprnd -misel -m32 -mhard-float -mabi=spe -mmfpgpr -mfloat-gprs=single


Please notice the -mfloat-gprs=single flag. That is the one that is giving problems.



When I use -mfloat-gprs=single, I am not able to compile things properly, as some functions are not implemented:



undefined reference to `__extendsfdf2`,
undefined reference to `__adddf3`,
undefined reference to `__divdf3`,


- among others.



Now, if I compile using -mfloat-gprs=double, it goes till the end and generate all my execution files. BUT, using this flag also generates extra functions, not implemented by the e200z7. I can't tell for sure all of them, as the code is getting bigger and it is mostly impossible to track all generated assembly. For instance, at the moment my execution gets stuck when it reaches the efscfd instruction, which is implemented by the e500 core, that has double precision floating point support, but not for the e200, that has single precision support only.



So, any piece of advice here would be amazingly welcome!



Thanks in advance,










share|improve this question

























  • The doc for -mfloat-gprs says "This option is currently only available on the MPC854x."

    – Marc Glisse
    Nov 21 '18 at 20:52











  • Hey Marc, indeed it says. still, it works. I have two "architectures": the board I am working on and qemu. QeMU emulates an e500 core and the board has two e200z7 cores. I have to set the flags individually for each one of them, and the -mfloat-gprs affects directly the outcome for both. In my opinion, the comments regarding this flag are legacy, and do not reflect newer GCC versions.

    – Felipe GM
    Nov 22 '18 at 18:10











  • You'll probably have to post to the gcc-help mailing list or create an issue on gcc's bugzilla...

    – Marc Glisse
    Nov 22 '18 at 18:13














0












0








0








Currently I am developing for a MPC5777 board, with e200z7 cores. Most of the things are going well, but I am stuck with a problem that is really annoying me already.
I am trying to use floating point operations on portions of my code, using the embedded hardware support. My toolchain is GCC 6.3 (powerpc-gcc), for which I am using the following flags:



ASFLAGS_BASE = -g -a32 -mbooke -me500 --fatal-warnings

ARCH_FLAGS = -mpowerpc-gpopt -mfprnd -misel -m32 -mhard-float -mabi=spe -mmfpgpr -mfloat-gprs=single


Please notice the -mfloat-gprs=single flag. That is the one that is giving problems.



When I use -mfloat-gprs=single, I am not able to compile things properly, as some functions are not implemented:



undefined reference to `__extendsfdf2`,
undefined reference to `__adddf3`,
undefined reference to `__divdf3`,


- among others.



Now, if I compile using -mfloat-gprs=double, it goes till the end and generate all my execution files. BUT, using this flag also generates extra functions, not implemented by the e200z7. I can't tell for sure all of them, as the code is getting bigger and it is mostly impossible to track all generated assembly. For instance, at the moment my execution gets stuck when it reaches the efscfd instruction, which is implemented by the e500 core, that has double precision floating point support, but not for the e200, that has single precision support only.



So, any piece of advice here would be amazingly welcome!



Thanks in advance,










share|improve this question
















Currently I am developing for a MPC5777 board, with e200z7 cores. Most of the things are going well, but I am stuck with a problem that is really annoying me already.
I am trying to use floating point operations on portions of my code, using the embedded hardware support. My toolchain is GCC 6.3 (powerpc-gcc), for which I am using the following flags:



ASFLAGS_BASE = -g -a32 -mbooke -me500 --fatal-warnings

ARCH_FLAGS = -mpowerpc-gpopt -mfprnd -misel -m32 -mhard-float -mabi=spe -mmfpgpr -mfloat-gprs=single


Please notice the -mfloat-gprs=single flag. That is the one that is giving problems.



When I use -mfloat-gprs=single, I am not able to compile things properly, as some functions are not implemented:



undefined reference to `__extendsfdf2`,
undefined reference to `__adddf3`,
undefined reference to `__divdf3`,


- among others.



Now, if I compile using -mfloat-gprs=double, it goes till the end and generate all my execution files. BUT, using this flag also generates extra functions, not implemented by the e200z7. I can't tell for sure all of them, as the code is getting bigger and it is mostly impossible to track all generated assembly. For instance, at the moment my execution gets stuck when it reaches the efscfd instruction, which is implemented by the e500 core, that has double precision floating point support, but not for the e200, that has single precision support only.



So, any piece of advice here would be amazingly welcome!



Thanks in advance,







gcc powerpc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 9:00









Jeremy Kerr

1,582920




1,582920










asked Nov 20 '18 at 22:06









Felipe GMFelipe GM

3415




3415













  • The doc for -mfloat-gprs says "This option is currently only available on the MPC854x."

    – Marc Glisse
    Nov 21 '18 at 20:52











  • Hey Marc, indeed it says. still, it works. I have two "architectures": the board I am working on and qemu. QeMU emulates an e500 core and the board has two e200z7 cores. I have to set the flags individually for each one of them, and the -mfloat-gprs affects directly the outcome for both. In my opinion, the comments regarding this flag are legacy, and do not reflect newer GCC versions.

    – Felipe GM
    Nov 22 '18 at 18:10











  • You'll probably have to post to the gcc-help mailing list or create an issue on gcc's bugzilla...

    – Marc Glisse
    Nov 22 '18 at 18:13



















  • The doc for -mfloat-gprs says "This option is currently only available on the MPC854x."

    – Marc Glisse
    Nov 21 '18 at 20:52











  • Hey Marc, indeed it says. still, it works. I have two "architectures": the board I am working on and qemu. QeMU emulates an e500 core and the board has two e200z7 cores. I have to set the flags individually for each one of them, and the -mfloat-gprs affects directly the outcome for both. In my opinion, the comments regarding this flag are legacy, and do not reflect newer GCC versions.

    – Felipe GM
    Nov 22 '18 at 18:10











  • You'll probably have to post to the gcc-help mailing list or create an issue on gcc's bugzilla...

    – Marc Glisse
    Nov 22 '18 at 18:13

















The doc for -mfloat-gprs says "This option is currently only available on the MPC854x."

– Marc Glisse
Nov 21 '18 at 20:52





The doc for -mfloat-gprs says "This option is currently only available on the MPC854x."

– Marc Glisse
Nov 21 '18 at 20:52













Hey Marc, indeed it says. still, it works. I have two "architectures": the board I am working on and qemu. QeMU emulates an e500 core and the board has two e200z7 cores. I have to set the flags individually for each one of them, and the -mfloat-gprs affects directly the outcome for both. In my opinion, the comments regarding this flag are legacy, and do not reflect newer GCC versions.

– Felipe GM
Nov 22 '18 at 18:10





Hey Marc, indeed it says. still, it works. I have two "architectures": the board I am working on and qemu. QeMU emulates an e500 core and the board has two e200z7 cores. I have to set the flags individually for each one of them, and the -mfloat-gprs affects directly the outcome for both. In my opinion, the comments regarding this flag are legacy, and do not reflect newer GCC versions.

– Felipe GM
Nov 22 '18 at 18:10













You'll probably have to post to the gcc-help mailing list or create an issue on gcc's bugzilla...

– Marc Glisse
Nov 22 '18 at 18:13





You'll probably have to post to the gcc-help mailing list or create an issue on gcc's bugzilla...

– Marc Glisse
Nov 22 '18 at 18:13












1 Answer
1






active

oldest

votes


















0














In case someone ends up here with a similar problem, I have fixed it by using three flags:



-mfloat-gprs=single -Wdouble-promotion -fsingle-precision-constant



What they do is:
-mfloat-gprs=single tells the compiler to use general purpose register for floating point operations, instead of floating point registers. =single means it has single precision



-Wdouble-promotion enables a compiler warning for when gcc tries to convert a single float to a double float



-fsingle-precision-constant enforces GCC not to convert single float to double float



I am using -fsingle-precision-constant and -Wdouble-promotion at the same time to be 100% that double will not be used.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402307%2fpowerpc-gcc-floating-point-instructions%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In case someone ends up here with a similar problem, I have fixed it by using three flags:



    -mfloat-gprs=single -Wdouble-promotion -fsingle-precision-constant



    What they do is:
    -mfloat-gprs=single tells the compiler to use general purpose register for floating point operations, instead of floating point registers. =single means it has single precision



    -Wdouble-promotion enables a compiler warning for when gcc tries to convert a single float to a double float



    -fsingle-precision-constant enforces GCC not to convert single float to double float



    I am using -fsingle-precision-constant and -Wdouble-promotion at the same time to be 100% that double will not be used.






    share|improve this answer




























      0














      In case someone ends up here with a similar problem, I have fixed it by using three flags:



      -mfloat-gprs=single -Wdouble-promotion -fsingle-precision-constant



      What they do is:
      -mfloat-gprs=single tells the compiler to use general purpose register for floating point operations, instead of floating point registers. =single means it has single precision



      -Wdouble-promotion enables a compiler warning for when gcc tries to convert a single float to a double float



      -fsingle-precision-constant enforces GCC not to convert single float to double float



      I am using -fsingle-precision-constant and -Wdouble-promotion at the same time to be 100% that double will not be used.






      share|improve this answer


























        0












        0








        0







        In case someone ends up here with a similar problem, I have fixed it by using three flags:



        -mfloat-gprs=single -Wdouble-promotion -fsingle-precision-constant



        What they do is:
        -mfloat-gprs=single tells the compiler to use general purpose register for floating point operations, instead of floating point registers. =single means it has single precision



        -Wdouble-promotion enables a compiler warning for when gcc tries to convert a single float to a double float



        -fsingle-precision-constant enforces GCC not to convert single float to double float



        I am using -fsingle-precision-constant and -Wdouble-promotion at the same time to be 100% that double will not be used.






        share|improve this answer













        In case someone ends up here with a similar problem, I have fixed it by using three flags:



        -mfloat-gprs=single -Wdouble-promotion -fsingle-precision-constant



        What they do is:
        -mfloat-gprs=single tells the compiler to use general purpose register for floating point operations, instead of floating point registers. =single means it has single precision



        -Wdouble-promotion enables a compiler warning for when gcc tries to convert a single float to a double float



        -fsingle-precision-constant enforces GCC not to convert single float to double float



        I am using -fsingle-precision-constant and -Wdouble-promotion at the same time to be 100% that double will not be used.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 28 '18 at 20:48









        Felipe GMFelipe GM

        3415




        3415
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402307%2fpowerpc-gcc-floating-point-instructions%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Hercules Kyvelos

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud