ecnelises wrote: The motivating case:
```llvm define i64 @splatByte(i64 %a) { entry: %x0 = shl i64 %a, 8 %x1 = and i64 %a, 255 %x2 = or i64 %x0, %x1 %x3 = shl i64 %x2, 16 %x4 = and i64 %x2, 65535 %x5 = or i64 %x3, %x4 %x6 = shl i64 %x5, 32 %x7 = and i64 %x5, 4294967295 %x8 = or i64 %x6, %x7 ret i64 %x8 } ``` ``` ; before patch rotldi 4, 3, 32 rlwimi 4, 3, 0, 24, 31 rlwimi 4, 3, 8, 16, 23 rlwimi 4, 3, 16, 8, 15 rlwimi 4, 3, 24, 0, 7 rldimi 4, 3, 40, 16 rldimi 4, 3, 48, 8 rldimi 4, 3, 56, 0 mr 3, 4 ; after patch rldimi 3, 3, 8, 0 rldimi 3, 3, 16, 0 rlwinm 3, 3, 0, 1, 0 ``` Bit permutation is not good at selecting globally optimized result. This is the limitation until a better selector respecting rotate operations is introduced. https://github.com/llvm/llvm-project/pull/66040 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits