Much like fixed-point to floating-point conversion, the converse can also be transformed into a fixed-point VCVT. This patch transforms multiplications of floating point numbers by 2^n into a VCVT_fix. The exception is that a conversion with 1 fractional bit ends up being an FADD (FADD(x, x) emulates FMUL(x, 2)) rather than an FMUL so there is a special case for that. This patch also moves the code from https://reviews.llvm.org/D103903 into a separate function as fixed to float and float to fixed are very similar.
Details
Diff Detail
Event Timeline
Nice. I wasn't expecting this to share as much code, that's good to see.
llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp | ||
---|---|---|
3157–3160 | You can likely not pass dl, using SDLoc(N) again here. | |
3190–3191 | auto -> SDValue Should VecVal be different for the two cases? Otherwise below it uses the fmul->operand(0)->operand(0). | |
3193 | Can this use getScalarSizeInBits? | |
3212–3219 | Maybe expand the comment to talk about both FixedToFloat and FloatToFixed | |
3262 | auto -> EVT | |
3268 | auto -> SDNode * | |
3318 | The second N should be LHS? | |
llvm/test/CodeGen/Thumb2/mve-vcvt-float-to-fixed.ll | ||
803 | Does this need updating? and vcvt_u32_33 below. | |
987 | These too. |
Stop passing dl, check if VecVal is an int to fp node, use getScalarSizeInBits() and fix copied tests.
llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp | ||
---|---|---|
3198 | Should this still check for the same size of the bitcast on ImmNode? | |
3298 | This can drop the brackets, from a single statement. | |
llvm/test/CodeGen/Thumb2/mve-vcvt-float-to-fixed.ll | ||
312 | Should this be 0x41E0000000000000 ? | |
324 | And this 0x41F0000000000000 | |
336 | And this 0x4200000000000000 ? | |
1020 | I'm not sure if these are interesting negative constants any more. |
clang-tidy: warning: invalid case style for function 'tryFP_TO_INT' [readability-identifier-naming]
not useful
clang-tidy: warning: invalid case style for parameter 'dl' [readability-identifier-naming]
not useful