fpu usefulness?
fpu usefulness?
Is there anything fpu (x87) is usefull? Or its jsut included for backward compatibility?
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: fpu usefulness?
It does all floating point operations. If you want to use float, double, long double and their associated operations (which are part of the C standard), you need it (or need to emulate it if the machine doesn't have it, which is rare).
Re: fpu usefulness?
MMX instructions also rely upon it, witch since the 64bit CPU became mainstream is almost useless. And SSE is much better. But good for compatibility...
@NickJohnson: I'm not to familiar with C (novice quite actually), but wouldn't it make scene for newer compilers to use SSE for floating point operations depending on the target processor?
@NickJohnson: I'm not to familiar with C (novice quite actually), but wouldn't it make scene for newer compilers to use SSE for floating point operations depending on the target processor?
My hero, is Mel.
Re: fpu usefulness?
im talking about thinks like fadd/fmul/fdiv. Yes double extended precision is 80 bits, but will it make a huge diffrence in long mode?
All arithmetics can be done on 64bit integer registers, why use fpu? The only thing fpu can be usefull is when you have a data larger than 64 bits, but smaller than 80.
Why use fpu at all?
Ok 20 years ago when nly 16bit cpus existed fpu might have been a good idea (16bit vs 80bit diffrent chip). But today? Give me a good example of calculation wich can REALLY benefit from using fpu instead of 64bit GPR.
All arithmetics can be done on 64bit integer registers, why use fpu? The only thing fpu can be usefull is when you have a data larger than 64 bits, but smaller than 80.
Why use fpu at all?
Whats the diffrence between float and int? Its just representation of data. Why would i need exponent part? All that matters is mantisa.you want to use float, double, long double and their associated operations (which are part of the C standard), you need it (or need to emulate it if the machine doesn't have it, which is rare).
Ok 20 years ago when nly 16bit cpus existed fpu might have been a good idea (16bit vs 80bit diffrent chip). But today? Give me a good example of calculation wich can REALLY benefit from using fpu instead of 64bit GPR.
Re: fpu usefulness?
Because the FPU can do such arithmetics orders of magnitude faster. That is what it was designed for, and that is why it is still included in modern architectures.a5498828 wrote:All arithmetics can be done on 64bit integer registers, why use fpu?
There are whole families of CPUs that are optimized for FPU performance, with integer performance that you would probably sneer at. They sell very well. There is a reason that performance of supercomputers is often calculated in GFLOPS (giga float operations / second) instead of MIPS (million -integer- instructions / second).
A special treat is the RIKEN MDGRAPE-3. That baby has been custom-built to do proteine structure prediction, reaching the PetaFLOP level. Integer performance just isn't important here.
No it doesn't. One of the advantages of floats is that they can store a much larger range of values.Whats the diffrence between float and int? Its just representation of data. Why would i need exponent part? All that matters is mantisa.
A 64bit int stores values from -2^63 to 2^63-1.
A 64bit float can store values from 2^1023 to -2^1023, or values as small as 2^-1022. With a limited precision, of course, but for those things the FPU is used for, you don't need unlimited precision.
Any 3D game engine, scientific simulation (meteorology for example), any kind of signal processing (audio, for example).Give me a good example of calculation wich can REALLY benefit from using fpu instead of 64bit GPR.
You do know that any modern graphics chip is essentially a highly parallel FPU unit?
Read up on double precision FP format, floating point and floating point units.
Every good solution is obvious once you've found it.
Re: fpu usefulness?
80bit float is 64bit mantisa, sign and 15 bit exponent.
64bit mantisa can hold 2^64 (not counting Nan/inf/zero) values, ranging from 1.00000...1 to 1.11111.1.
exponent can hold 2^15 values (max is 32k not counting NaN/inf). Mantisa is shifted by exponent value, so mantisa can be as large as m^32k.
Ok this is larger than integer representation, but so what? Its like taking 2 integer registers, loading first with mantisa and second with exponent. Calculations are done only on mantisa, exponent is just a shift factor.
And if i want to add 2 numbers, first with small second with large exponent i dont see how would it work.
I understand that fpu is unreliable, but is it really so superior to integer calculations?
I can emulate it with integer registers, 1 mantisa second exponent, an number with smaller exponent simply shift right. If i lose bits oh well that happens. fpu work this way.
Tell me why bother with FPU, what benefits will i get by using it instead of register instructions.
First what came to my mind is crypto, calculation modular exponentation without modulo after each multiplication.
Lets take exponent 128 bits and base 128 bits. Result would be 16k bits wide. Okay, that fits into range. But hey, only 64bits are variable, rest are zeros. So its a bad idea.
Anything done with fpu can be done on integer registers with i belive better efficiency.
Why? Im not sure, but lets take addition.
First i determine wich exponent is larger. I shift mantisa of lower exponent right by bit diffrence and then add.
its a few instructions. Ok, fadd use only one. Is that it? Is it the reason x87 didnt died out?
So idea of FPU is to calculate data i dont need to keep track of every bit but rather allow it bo be wide in range?
if i dont care that 100 + 1 is still 100 fpu is for me.
64bit mantisa can hold 2^64 (not counting Nan/inf/zero) values, ranging from 1.00000...1 to 1.11111.1.
exponent can hold 2^15 values (max is 32k not counting NaN/inf). Mantisa is shifted by exponent value, so mantisa can be as large as m^32k.
Ok this is larger than integer representation, but so what? Its like taking 2 integer registers, loading first with mantisa and second with exponent. Calculations are done only on mantisa, exponent is just a shift factor.
And if i want to add 2 numbers, first with small second with large exponent i dont see how would it work.
I understand that fpu is unreliable, but is it really so superior to integer calculations?
I can emulate it with integer registers, 1 mantisa second exponent, an number with smaller exponent simply shift right. If i lose bits oh well that happens. fpu work this way.
Tell me why bother with FPU, what benefits will i get by using it instead of register instructions.
First what came to my mind is crypto, calculation modular exponentation without modulo after each multiplication.
Lets take exponent 128 bits and base 128 bits. Result would be 16k bits wide. Okay, that fits into range. But hey, only 64bits are variable, rest are zeros. So its a bad idea.
Anything done with fpu can be done on integer registers with i belive better efficiency.
Why? Im not sure, but lets take addition.
First i determine wich exponent is larger. I shift mantisa of lower exponent right by bit diffrence and then add.
its a few instructions. Ok, fadd use only one. Is that it? Is it the reason x87 didnt died out?
So idea of FPU is to calculate data i dont need to keep track of every bit but rather allow it bo be wide in range?
if i dont care that 100 + 1 is still 100 fpu is for me.
Re: fpu usefulness?
Which is exactly what the x87 floating point representation is. What is your point? That you may do all calculations on the exponent and mantissa by hand? Be my guest...a5498828 wrote:I can emulate it with integer registers, 1 mantisa second exponent, an number with smaller exponent simply shift right.
Re: fpu usefulness?
OK, now I start being annoyed. Do you really think you are smarter than all the CPU designers in the world together?
It's not any FPU designer's fault that you are not educated enough in computer science (or, even, simple reading of, say, my previous post) to grasp the concept that, in many fields of science and calculation, 15 digits of mantissa precision are plenty enough and the speed of calculations does matter.
Go play a round of your ego shooter of choice. Enjoy the high frame rate and remain blisfully ignorant of the technology driving it.
It is faster! Damn, what is so difficult to understand about it? Of course you can do all those calculations in integer registers, but a FPU will run circles around you!a5498828 wrote:I understand that fpu is unreliable, but is it really so superior to integer calculations?
That is where you are plain, repeatedly, stupidly, ignorantly wrong. (Did you bother to read any of the links I gave you?)Anything done with fpu can be done on integer registers with i belive better efficiency.
If you take into account that an MMX / SSE CPU can do that addition on several registers at once in less operations...Why? Im not sure, but lets take addition.
First i determine wich exponent is larger. I shift mantisa of lower exponent right by bit diffrence and then add.
its a few instructions. Ok, fadd use only one. Is that it?
You have passed from the realm of being unaware into the realm of being ignorant on purpose.So idea of FPU is to calculate data i dont need to keep track of every bit but rather allow it bo be wide in range?
if i dont care that 100 + 1 is still 100 fpu is for me.
It's not any FPU designer's fault that you are not educated enough in computer science (or, even, simple reading of, say, my previous post) to grasp the concept that, in many fields of science and calculation, 15 digits of mantissa precision are plenty enough and the speed of calculations does matter.
Go play a round of your ego shooter of choice. Enjoy the high frame rate and remain blisfully ignorant of the technology driving it.
Every good solution is obvious once you've found it.
Re: fpu usefulness?
To the OP: this is what emulators do, and why emulators are slow.Solar wrote:Of course you can do all those calculations in integer registers, but a FPU will run circles around you!
Re: fpu usefulness?
Speaking of which, are there still x87 emulators operating out there? The FPU has been built-in since the 486.
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: fpu usefulness?
I'm sure that I've seen an "emulate x87" option in the Linux kernel config.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: fpu usefulness?
Not all 386 and 486 machines have an fpu. And you might find some excuse to fix certain (old) FPU bugs.
Re: fpu usefulness?
I meant: are there still x86 machines out there without an FPU that do use floating point arithmetic and therefore need an emulator? Not that many, I guess...
Combuster,
Using an emulator to fix some FPU bugs may be reasonable, but it does seem like overkill to me.
Anyway, I'm just being curious. I am sure some people have good reasons to use an emulator.
Combuster,
Using an emulator to fix some FPU bugs may be reasonable, but it does seem like overkill to me.
Anyway, I'm just being curious. I am sure some people have good reasons to use an emulator.
Re: fpu usefulness?
No. It's there to consume power just to keep electric power companies happy. Rendering farms would do so much better without it.a5498828 wrote:Is there anything fpu (x87) is usefull?
____
Dario
Dario