GCC: Specifying mmx register for a local variable fails2019 Community Moderator Electionerror: command 'gcc' failed with exit status 1How do I achieve the theoretical maximum of 4 FLOPs per cycle?Is codecvt not a std header?Error: `#elif with no expression` - happens only on WindowsApplication segmentation fault, only when compiling on Windows with MinGWc++11 GCC compiling failingHow to use va_list object in a nested way, especially on gcc x64 compilerHow do I tell GCC asm that an input register is clobbered?error: 'unordered_set' is not a member of 'std'gcc cannot find -lgcc, g++.exe: error: CreateProcess: No such file or directory

The meaning of ‘otherwise’

In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?

After `ssh` without `-X` to a machine, is it possible to change `$DISPLAY` to make it work like `ssh -X`?

How do electrons receive energy when a body is heated?

What will happen if my luggage gets delayed?

How does Ehrenfest's theorem apply to the quantum harmonic oscillator?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

Outlet with 3 sets of wires

Can the alpha, lambda values of a glmnet object output determine whether ridge or Lasso?

Specifying a starting column with colortbl package and xcolor

From an axiomatic set theoric approach why can we take uncountable unions?

How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?

Is this Paypal Github SDK reference really a dangerous site?

PTIJ: Why does only a Shor Tam ask at the Seder, and not a Shor Mu'ad?

Can one live in the U.S. and not use a credit card?

Windows Server Data Center Edition - Unlimited Virtual Machines

How do we create new idioms and use them in a novel?

For which categories of spectra is there an explicit description of the fibrant objects via lifting properties?

Having the player face themselves after the mid-game

Gaining more land

Finitely many repeated replacements

What is the population of Romulus in the TNG era?

Is it possible to avoid unpacking when merging Association?

When Schnorr signatures are part of Bitcoin will it be possible validate each block with only one signature validation?



GCC: Specifying mmx register for a local variable fails



2019 Community Moderator Electionerror: command 'gcc' failed with exit status 1How do I achieve the theoretical maximum of 4 FLOPs per cycle?Is codecvt not a std header?Error: `#elif with no expression` - happens only on WindowsApplication segmentation fault, only when compiling on Windows with MinGWc++11 GCC compiling failingHow to use va_list object in a nested way, especially on gcc x64 compilerHow do I tell GCC asm that an input register is clobbered?error: 'unordered_set' is not a member of 'std'gcc cannot find -lgcc, g++.exe: error: CreateProcess: No such file or directory










0















Im trying to achieve the following on a Windows environment c++, MINGW GCC:



Im trying to define a local variable as such:



register DWORD index __asm ("%mm7");



this definition compiles with MINGW GCC x64 , but fails on x86 compilation with the error
error: invalid register name for 'index'
register DWORD index __asm ("%mm7");



I have already tried to reference the register as __asm ("mm7"); but to no avail. any help on the matter would be very appreciated










share|improve this question









New contributor




win32api is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I'm pretty sure you can only use general purpose registers with this feature. What are you trying to do?

    – fuz
    Mar 6 at 14:29











  • Whats weird is that it does succeed on a x64 toolchain compilation. im trying to save the value in this register to be referenced later by a different func, by accessing the register

    – win32api
    Mar 6 at 14:31







  • 2





    Try specifying -march=native or -mmmx.

    – Maxim Egorushkin
    Mar 6 at 16:17






  • 1





    I'd also question how this is being used.It should be noted that using register DWORD index __asm ("%mm7"); doesn't guarantee the variable index would be in mm7. The only guarantee is that if index was used as an operand to inline assembly using a "y" constraint, mm7 would be the register used. As @MaximEgorushkin points out to even get this going you'd have to tell the compiler to use MMX via the -mmmx option. x86-64 should compile without error b/c all x86-64 processors can use MMX registers,but not all x86 targets support MMX so the compiler has to be told to use them or not.

    – Michael Petch
    Mar 6 at 18:34






  • 1





    Compiling without error and generating the code you expect are two different issues.

    – Michael Petch
    Mar 6 at 18:35















0















Im trying to achieve the following on a Windows environment c++, MINGW GCC:



Im trying to define a local variable as such:



register DWORD index __asm ("%mm7");



this definition compiles with MINGW GCC x64 , but fails on x86 compilation with the error
error: invalid register name for 'index'
register DWORD index __asm ("%mm7");



I have already tried to reference the register as __asm ("mm7"); but to no avail. any help on the matter would be very appreciated










share|improve this question









New contributor




win32api is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I'm pretty sure you can only use general purpose registers with this feature. What are you trying to do?

    – fuz
    Mar 6 at 14:29











  • Whats weird is that it does succeed on a x64 toolchain compilation. im trying to save the value in this register to be referenced later by a different func, by accessing the register

    – win32api
    Mar 6 at 14:31







  • 2





    Try specifying -march=native or -mmmx.

    – Maxim Egorushkin
    Mar 6 at 16:17






  • 1





    I'd also question how this is being used.It should be noted that using register DWORD index __asm ("%mm7"); doesn't guarantee the variable index would be in mm7. The only guarantee is that if index was used as an operand to inline assembly using a "y" constraint, mm7 would be the register used. As @MaximEgorushkin points out to even get this going you'd have to tell the compiler to use MMX via the -mmmx option. x86-64 should compile without error b/c all x86-64 processors can use MMX registers,but not all x86 targets support MMX so the compiler has to be told to use them or not.

    – Michael Petch
    Mar 6 at 18:34






  • 1





    Compiling without error and generating the code you expect are two different issues.

    – Michael Petch
    Mar 6 at 18:35













0












0








0








Im trying to achieve the following on a Windows environment c++, MINGW GCC:



Im trying to define a local variable as such:



register DWORD index __asm ("%mm7");



this definition compiles with MINGW GCC x64 , but fails on x86 compilation with the error
error: invalid register name for 'index'
register DWORD index __asm ("%mm7");



I have already tried to reference the register as __asm ("mm7"); but to no avail. any help on the matter would be very appreciated










share|improve this question









New contributor




win32api is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












Im trying to achieve the following on a Windows environment c++, MINGW GCC:



Im trying to define a local variable as such:



register DWORD index __asm ("%mm7");



this definition compiles with MINGW GCC x64 , but fails on x86 compilation with the error
error: invalid register name for 'index'
register DWORD index __asm ("%mm7");



I have already tried to reference the register as __asm ("mm7"); but to no avail. any help on the matter would be very appreciated







c++ assembly x86 g++ mingw






share|improve this question









New contributor




win32api is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




win32api is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Mar 6 at 23:22









Michael Petch

26.5k556105




26.5k556105






New contributor




win32api is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Mar 6 at 14:24









win32apiwin32api

1




1




New contributor




win32api is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





win32api is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






win32api is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • I'm pretty sure you can only use general purpose registers with this feature. What are you trying to do?

    – fuz
    Mar 6 at 14:29











  • Whats weird is that it does succeed on a x64 toolchain compilation. im trying to save the value in this register to be referenced later by a different func, by accessing the register

    – win32api
    Mar 6 at 14:31







  • 2





    Try specifying -march=native or -mmmx.

    – Maxim Egorushkin
    Mar 6 at 16:17






  • 1





    I'd also question how this is being used.It should be noted that using register DWORD index __asm ("%mm7"); doesn't guarantee the variable index would be in mm7. The only guarantee is that if index was used as an operand to inline assembly using a "y" constraint, mm7 would be the register used. As @MaximEgorushkin points out to even get this going you'd have to tell the compiler to use MMX via the -mmmx option. x86-64 should compile without error b/c all x86-64 processors can use MMX registers,but not all x86 targets support MMX so the compiler has to be told to use them or not.

    – Michael Petch
    Mar 6 at 18:34






  • 1





    Compiling without error and generating the code you expect are two different issues.

    – Michael Petch
    Mar 6 at 18:35

















  • I'm pretty sure you can only use general purpose registers with this feature. What are you trying to do?

    – fuz
    Mar 6 at 14:29











  • Whats weird is that it does succeed on a x64 toolchain compilation. im trying to save the value in this register to be referenced later by a different func, by accessing the register

    – win32api
    Mar 6 at 14:31







  • 2





    Try specifying -march=native or -mmmx.

    – Maxim Egorushkin
    Mar 6 at 16:17






  • 1





    I'd also question how this is being used.It should be noted that using register DWORD index __asm ("%mm7"); doesn't guarantee the variable index would be in mm7. The only guarantee is that if index was used as an operand to inline assembly using a "y" constraint, mm7 would be the register used. As @MaximEgorushkin points out to even get this going you'd have to tell the compiler to use MMX via the -mmmx option. x86-64 should compile without error b/c all x86-64 processors can use MMX registers,but not all x86 targets support MMX so the compiler has to be told to use them or not.

    – Michael Petch
    Mar 6 at 18:34






  • 1





    Compiling without error and generating the code you expect are two different issues.

    – Michael Petch
    Mar 6 at 18:35
















I'm pretty sure you can only use general purpose registers with this feature. What are you trying to do?

– fuz
Mar 6 at 14:29





I'm pretty sure you can only use general purpose registers with this feature. What are you trying to do?

– fuz
Mar 6 at 14:29













Whats weird is that it does succeed on a x64 toolchain compilation. im trying to save the value in this register to be referenced later by a different func, by accessing the register

– win32api
Mar 6 at 14:31






Whats weird is that it does succeed on a x64 toolchain compilation. im trying to save the value in this register to be referenced later by a different func, by accessing the register

– win32api
Mar 6 at 14:31





2




2





Try specifying -march=native or -mmmx.

– Maxim Egorushkin
Mar 6 at 16:17





Try specifying -march=native or -mmmx.

– Maxim Egorushkin
Mar 6 at 16:17




1




1





I'd also question how this is being used.It should be noted that using register DWORD index __asm ("%mm7"); doesn't guarantee the variable index would be in mm7. The only guarantee is that if index was used as an operand to inline assembly using a "y" constraint, mm7 would be the register used. As @MaximEgorushkin points out to even get this going you'd have to tell the compiler to use MMX via the -mmmx option. x86-64 should compile without error b/c all x86-64 processors can use MMX registers,but not all x86 targets support MMX so the compiler has to be told to use them or not.

– Michael Petch
Mar 6 at 18:34





I'd also question how this is being used.It should be noted that using register DWORD index __asm ("%mm7"); doesn't guarantee the variable index would be in mm7. The only guarantee is that if index was used as an operand to inline assembly using a "y" constraint, mm7 would be the register used. As @MaximEgorushkin points out to even get this going you'd have to tell the compiler to use MMX via the -mmmx option. x86-64 should compile without error b/c all x86-64 processors can use MMX registers,but not all x86 targets support MMX so the compiler has to be told to use them or not.

– Michael Petch
Mar 6 at 18:34




1




1





Compiling without error and generating the code you expect are two different issues.

– Michael Petch
Mar 6 at 18:35





Compiling without error and generating the code you expect are two different issues.

– Michael Petch
Mar 6 at 18:35












0






active

oldest

votes











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
);



);






win32api is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55025376%2fgcc-specifying-mmx-register-for-a-local-variable-fails%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








win32api is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















win32api is a new contributor. Be nice, and check out our Code of Conduct.












win32api is a new contributor. Be nice, and check out our Code of Conduct.











win32api is a new contributor. Be nice, and check out our Code of Conduct.














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%2f55025376%2fgcc-specifying-mmx-register-for-a-local-variable-fails%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







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved