This is used on AMDGPU for rounding from v3f64 (which is illegal) to
v3f32 (which is legal).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I think the code looks fine, but it doesn't look like some of the code is tested. And may not be testable?
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp | ||
---|---|---|
4301–4302 | I'm not sure how this if could be true given that the opposite was checked in outer if. But since that was already like that when you got here this looks fine. | |
llvm/test/CodeGen/AMDGPU/fptrunc.ll | ||
34 | Is this hitting the unrolling path rather than any of the code that creates a wider node? |
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp | ||
---|---|---|
4301–4302 | I hadn't noticed that. My guess is that the check for !N->isStrictFPOpcode() in the outer if was added along with the FIXME comment, so maybe it was supposed to be a temporary fix? | |
llvm/test/CodeGen/AMDGPU/fptrunc.ll | ||
34 | The test definitely fails without the fix above, but I haven't looked in detail at how it is handled. |
llvm/test/CodeGen/AMDGPU/fptrunc.ll | ||
---|---|---|
34 | I would expect this to hit the unroll path. v3f64 isn't legal |
llvm/test/CodeGen/AMDGPU/fptrunc.ll | ||
---|---|---|
34 | If I'm reading the legalize-types debug output correctly it is being widened to v4 and then split to v2: Legalizing node: t33: v3f32 = fp_round t30, TargetConstant:i64<0> Analyzing result type: v3f32 Legal result type Analyzing operand: t30: v3f64 = extract_subvector t37, Constant:i32<0> Widen node operand 0: t33: v3f32 = fp_round t30, TargetConstant:i64<0> Legalizing node: t49: v4f32 = fp_round t37, TargetConstant:i64<0> Analyzing result type: v4f32 Legal result type Analyzing operand: t37: v4f64 = bitcast t36 Split node operand: t49: v4f32 = fp_round t37, TargetConstant:i64<0> Is that a problem? Is my patch still OK? |
I'm not sure how this if could be true given that the opposite was checked in outer if. But since that was already like that when you got here this looks fine.