Jump to content
  • Advertisement
Sign in to follow this  
gasto

Immediate values come from the ALU?

This topic is 2061 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Are immediate values extracted from the ALU(Arithmetic logic unit)?

 

More code seems to be created (and hence program file size) when using many immediate values, but I assume it is stored in the program duration memory stack.

Share this post


Link to post
Share on other sites
Advertisement

Why is this thread tagged "C Language" and "C++"? I am pretty sure in the context of those languages there is no such thing as an ALU, and even "immediate value" is a foreign concept (although there are constants, which are related).

Share this post


Link to post
Share on other sites
This is an implementation detail that doesn't matter.

As far as the assembly programmer is concerned the data resides in a register or a memory address. When something is processed inside the CPU the black box does its magic, and the result is again stored in a register or memory address.

If you are an expert writing the optimizer inside a major compiler, and if you have studied the exact micro-architecture details, including a detailed study of the processor's internal timings, then it is possible that those details might help you with some extreme pigeonhole reordering optimizations in order to save one or two total CPU cycles, so perhaps it might save a few nanoseconds.

It has nothing to do with either C or C++ languages, and really almost has nothing to do with assembly programming.

Share this post


Link to post
Share on other sites
Immediate values in assembly are stored as part of the encoding of an instruction. For variable length instruction architectures, it may be that an instruction containing an immediate value has a longer encoding, than it's register or memory counterparts.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!