https://rise4fun.com/Alive/6bVL
AArch64 is clearly a regression, will need a separate fix
AMDGPU change looks bad either way - bfe is not used
X86 changes look neutral-positive, except vector cases, those are clearly regressions
Paths
| Differential D62100
[DAGCombine][X86][AMDGPU][AArch64] (srl (shl x, c1), c2) with c1 != c2 handling AbandonedPublic Authored by lebedev.ri on May 18 2019, 6:24 AM.
Details
Summary https://rise4fun.com/Alive/6bVL AArch64 is clearly a regression, will need a separate fix
Diff Detail
Event TimelineHerald added subscribers: kristof.beyls, t-tye, tpr and 7 others. · View Herald TranscriptMay 18 2019, 6:24 AM Comment Actions Looked at changes:
Comment Actions Looks like AMDGPU changes are neutral too.
lebedev.ri added inline comments.
lebedev.ri marked an inline comment as done. lebedev.ri added inline comments.
Revision Contents
Diff 200150 lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/AArch64/arm64-bitfield-extract.ll
test/CodeGen/AMDGPU/llvm.amdgcn.ubfe.ll
test/CodeGen/X86/pr32588.ll
test/CodeGen/X86/pull-binop-through-shift.ll
test/CodeGen/X86/rotate-extract-vector.ll
test/CodeGen/X86/rotate-extract.ll
test/CodeGen/X86/shift-mask.ll
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
After actually looking at -debug output, this regression happens because of SimplifyDemandedBits(),
which ignores AArch64TargetLowering::isDesirableToCommuteWithShift() override.
So when we get to AArch64TargetLowering::isBitfieldExtractOp(), we have
t18: i32 = srl t15, Constant:i64<2> t15: i32 = or t26, t24 t26: i32 = and t7, Constant:i32<1073741816> t7: i32,ch = load<(load 4 from %ir.y, align 8)> t0, t2, undef:i64 t2: i64,ch = CopyFromReg t0, Register:i64 %0 t1: i64 = Register %0 t6: i64 = undef t25: i32 = Constant<1073741816> t24: i32 = and t12, Constant:i32<4> t12: i32 = srl t4, Constant:i64<16> t4: i32,ch = CopyFromReg t0, Register:i32 %1 t3: i32 = Register %1 t11: i64 = Constant<16> t23: i32 = Constant<4> t17: i64 = Constant<2>I'm not sure how to turn this pattern on it's head to produce ubfx again.