Skip to main content
Tweeted twitter.com/StackCompSci/status/1123059552457580545
“do CPU do this” is industrial archaeology (off-topic) but “what are the implications of doing this” is computer design (on-topic)
Source Link

Do Can CPU's 'shortcut' adding 0, multiplying by 1, and multiplying by 0?

I am currently writing a program where a lot of adding 0 to numbers and multiplying by 1 and 0 occurs and it got me to wondering if the CPU 'shortcuts' (drops), these operations. I'm a CS student and this hasn't been brought up ever.

Can a CPU do this? What are the trade-offs in designing a CPU that detects +1, *1 and *0 and executes them faster?

Do CPU's 'shortcut' adding 0, multiplying by 1, and multiplying by 0?

I am currently writing a program where a lot of adding 0 to numbers and multiplying by 1 and 0 occurs and it got me to wondering if the CPU 'shortcuts' (drops), these operations. I'm a CS student and this hasn't been brought up ever.

Can CPU's 'shortcut' adding 0, multiplying by 1, and multiplying by 0?

I am currently writing a program where a lot of adding 0 to numbers and multiplying by 1 and 0 occurs and it got me to wondering if the CPU 'shortcuts' (drops), these operations. I'm a CS student and this hasn't been brought up ever.

Can a CPU do this? What are the trade-offs in designing a CPU that detects +1, *1 and *0 and executes them faster?

deleted 23 characters in body
Source Link
Evil
  • 9.5k
  • 11
  • 33
  • 53

I am currently writing a program where a lot of adding 0 to numbers and multiplying by 1 and 0 occurs and it got me to wondering if the CPU 'shortcuts', for lack of a better word (drops), these operations. I'm a CS student and this was hasn't been brought up ever.

I am currently writing a program where a lot of adding 0 to numbers and multiplying by 1 and 0 occurs and it got me to wondering if the CPU 'shortcuts', for lack of a better word, these operations. I'm a CS student and this was hasn't been brought up ever.

I am currently writing a program where a lot of adding 0 to numbers and multiplying by 1 and 0 occurs and it got me to wondering if the CPU 'shortcuts' (drops), these operations. I'm a CS student and this hasn't been brought up ever.

Post Migrated Here from electronics.stackexchange.com (revisions)
Source Link
Azaral
  • 183
  • 1
  • 3

Do CPU's 'shortcut' adding 0, multiplying by 1, and multiplying by 0?

I am currently writing a program where a lot of adding 0 to numbers and multiplying by 1 and 0 occurs and it got me to wondering if the CPU 'shortcuts', for lack of a better word, these operations. I'm a CS student and this was hasn't been brought up ever.