Questions tagged [fpu]

A floating-point unit is a part of a computer system specially designed to carry out operations on floating point numbers.

From Wikipedia:

A floating-point unit (FPU, colloquially a math coprocessor) is a part of a computer system specially designed to carry out operations on floating point numbers. Typical operations are addition, subtraction, multiplication, division, and square root. Some systems (particularly older, microcode-based architectures) can also perform various transcendental functions such as exponential or trigonometric calculations, though in most modern processors these are done with software library routines.

259 questions
6
votes
2 answers

Delphi 64 bits asm compiling error

The following functions do not compile with the 64 bits Delphi XE2 compiler. (The errors all relate to the fld instructions.) [dcc64 Error] Project1.dpr(12): E2116 Invalid combination of opcode and operands [dcc64 Error] Project1.dpr(13): E2116…
user1238784
  • 2,250
  • 3
  • 22
  • 41
5
votes
2 answers

Does decimal math use the FPU

Does decimal math use the FPU? I would think that the answer is yes, but I'm not sure, since a decimal is not a floating point, but a fixed precision number. I'm looking mostly for .NET, but a general answer would be useful too.
CodeMonkey1313
  • 15,717
  • 17
  • 76
  • 109
5
votes
1 answer

How to detect FPU in Cortex M?

Cortex-M processors implement the CPUID register, through which it is possible to detect information about the core: part number (e.g. Cortex M7 or M4), revision and patch level (e.g. r1p2), etc. Is there a register or a way to detect if the FPU has…
mastupristi
  • 1,240
  • 1
  • 13
  • 29
5
votes
2 answers

FPU operations generated by GCC during casting integer to float

I want to perform division on an FPU in C (using integer values): float foo; uint32_t *ptr1, *ptr2; foo = (float)*(ptr1) / (float)*(ptr2); And in NASM (from object compiled via GCC) it has following representation: mov rax, QWORD [ptr1] …
saleph
  • 149
  • 11
5
votes
1 answer

How slow is NaN arithmetic in the Intel x64 FPU?

Hints and allegations abound that arithmetic with NaNs can be 'slow' in hardware FPUs. Specifically in the modern x64 FPU, e.g on a Nehalem i7, is that still true? Do FPU multiplies get churned out at the same speed regardless of the values of the…
Sebastian Good
  • 6,310
  • 2
  • 33
  • 57
5
votes
1 answer

Fast float to int conversion and floating point precision on ARM (iPhone 3GS/4)

I read (http://www.stereopsis.com/FPU.html) mentioned in (What is the fastest way to convert float to int on x86). Does anyone know if the slow simple cast (see snippet below) does apply to ARM architecture, too? inline int Convert(float x) { int…
Lars Schneider
  • 5,530
  • 4
  • 33
  • 58
5
votes
2 answers

How can I set and restore FPU CTRL registers?

I can reset FPU's CTRL registers with this: http://support.microsoft.com/kb/326219 But how can I save current registers, and restore them later? It's from .net code.. What I'm doing, is from Delphi calling an .net dll as an COM module. Checking the…
neslekkiM
  • 693
  • 1
  • 8
  • 19
5
votes
3 answers

FLD instruction x64 bit

I have a little problem with FLD instruction in x64 bit ... want to load Double value to the stack pointer FPU in st0 register, but it seem to be impossible. In Delphi x32, I can use this code : function DoSomething(X:Double):Double; asm FLD …
SMP3
  • 71
  • 1
  • 6
4
votes
3 answers

What's the motivation for a fpu to implement their registers in stack-based fashion?

What's the motivation for a fpu to implement their registers in stack-based fashion? To my understanding other instructions-sets such as x86/sse use named registers. I can imagine the stack-based properties correspond with our thought of functions…
Lawrence Kok
  • 1,568
  • 11
  • 29
4
votes
1 answer

Efficient floating point modulus one in C (fractional part of a float)

I am searching for a very CPU efficient way to compute floating point modulus one (including negative values) in C. I am using it for normalized phase reduction (wrapping, i.e 7.6 -> 0.6, 0.2->0.2, -1.1 -> 0.9 and so on). From what I understood,…
elena
  • 233
  • 1
  • 7
4
votes
1 answer

What is the difference between -mfpu=fpv5-sp-d16 and -mfpu=fpv5-d16?

I'm trying to get the double precision FPv5-DP-D16-M FPU working on an ARM Cortex-M7f with an arm-none-eabi-gcc compiler. Based on the documentation, it would appear that I have two options to choose from for enabling the FPU: -mfpu=fpv5-d16 and…
user2465116
  • 388
  • 2
  • 10
4
votes
2 answers

Can I get a int from my EAX/RAX to a register of the FPU like st0?

I am currently working on a small Assembler project in University. Now my question is, is it possible to get a skalar for a multiplication (int), which is given by the user, from my EAX/RAX Register to one of my FPU register like st0? I am using…
J.B.
  • 91
  • 8
4
votes
6 answers

strange results of simple floating point operations - bad FPU internal state?

I have a software project in which I sometimes get strange results from small, simple floating point operations. I assume there is something I have missed, and would like some tips about how to debug the following problems: (the compiler used is MS…
4
votes
4 answers

How are floating point operations emulated in software?

How does software perform floating point arithmetic when the CPU has no (or buggy) floating point unit? Examples would be the PIC, AVR, and 8051 microcontrollers architectures.
andre_lamothe
  • 2,171
  • 2
  • 41
  • 74
4
votes
1 answer

Masking divide by 0 exception assembly masm

TITLE Unmasking an Exception (Exceptions.asm) ; This program shows how to mask (set) and unmask (clear) the divide by zero ; exception flag. INCLUDE Irvine32.inc .data ctrlWord WORD ? val1 DWORD 1 val2 REAL8 0.0 .code main PROC finit ;…
JimBob101
  • 173
  • 9
1
2
3
17 18