This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好!
我需要对 FPU 进行澄清:当我尝试在两个浮点之间执行简单的乘法运算时、我看不到任何性能改进。
的执行时间、例如:
float a = (float)2.1 * (float)3.2;
为178ns @ 120MHz、无论 FPU 是否激活。
为了激活 FPU、我执行:
FPUEnable(); FPULazyStackingEnable();
我在其他浮点运算中也看到了相同的行为、启用 FPU 后性能没有提高。 为什么?
我是否需要执行任何其他配置、或者这是正确的?
此致。
Paolo
您好!
如果您的构建选项指定了 FPU、则已在启动时启用 FPU。 请参见下面的。
启动文件默认启用 FPU。 因此、如果您尝试调用 FPUEnable、您可能看不到任何差异、因为它已启用。 如果您使用 FPUDisable、则应得到故障异常、因为代码被编译为使用 FPU 指令。 如果要比较 FPU 和非 FPU 之间的性能,则可以转到项目属性->处理器选项,选择 vfplib 而不是 FPvSPD16。 这将指示编译器使用软件库来实现浮点运算、该运算所需的周期比 FPU 所需的周期要多得多。
请参阅以下帖子。