DescriptionARM: Avoid VMSR instruction when converting to clamped uint8
Setting the FPSCR flags is expensive on some CPUs. Instead, do rounding
to the nearest integer by adding 0.5 and truncating towards zero.
Additional checks are needed to make sure that numbers ending in exactly
.5 get rounded to the nearest even number according to WebIDL spec, but
this case is relatively rare and even then the benefits outweigh the
costs. Performance increases ranging from 2x to 9x were seen in
measurements with a hot-loop benchmark depending on the CPU architecture.
This new code path is used on VFP3-capable processors, which have the
fixed-point conversion functions.
Generic ARM assembler, disassembler, and simulator functions are added
for the conversion between fixed point and floating point. A bug in
encoding the immediate value in the vcvt_f64_s32 instruction is also
fixed by this change. This did not cause behavioral issues before, since
in existing uses of the function the order of the bits in the immediate
value does not matter, as they are all 1.
BUG=3253
LOG=N
Patch Set 1 #
Total comments: 3
Messages
Total messages: 10 (0 generated)
|