Support VCVT for fixed point/float

Registered by Michael Hope on 2011-09-29

NEON and VFPv3 have VCVT which can convert between different data types. It's fairly common in codecs to do calculations in fixed point and then convert to floating point using code similar to:
 v = (float)i / (1 << constant)
or:
 v = i * (1.0f / (1 << constant))

This could be converted into a VCVT.F32.S32.

If y is a power of two then x / y is the same as x * (1/y), so this applies even without -ffast-math. GCC already detects this case and converts the floating point divide into a multiply.

Needs investigation to see what the speed up would be and how often it's used in hot loops. Is used in libav.

Blueprint information

Status:
Complete
Approver:
Michael Hope
Priority:
Medium
Drafter:
Michael Hope
Direction:
Approved
Assignee:
Ramana Radhakrishnan
Definition:
Approved
Series goal:
Accepted for 4.6
Implementation:
Implemented
Milestone target:
milestone icon 4.6-2012.03
Started by
Michael Hope on 2011-11-21
Completed by
Michael Hope on 2012-03-14

Related branches

Sprints

Whiteboard

Meta:
Headline: Investigate whether conversion from int to float using VCVT can speed up and how often it is used in hot loops
Acceptance: results of the investigation

Scalar patch (vfpv3) submitted here : http://gcc.gnu.org/ml/gcc-patches/2011-10/msg01961.html
Generate the equivalent vector (NEON) form: TODO

Summary from the 2011-10-04 performance call:
 * Likely to be done through combine
 * Likely to be low effort
 * Micro improvement is high
 * Occurrence is unknown

Approach would be the same for the vector form.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.