[all-commits] [llvm/llvm-project] a55a72: [X86] Narrow BT/BTC/BTR/BTS compare + RMW patterns...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Thu Oct 30 05:36:00 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a55a7207c7e4d98dad32e8d53dd5964ee833edd9
      https://github.com/llvm/llvm-project/commit/a55a7207c7e4d98dad32e8d53dd5964ee833edd9
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2025-10-30 (Thu, 30 Oct 2025)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/bittest-big-integer.ll

  Log Message:
  -----------
  [X86] Narrow BT/BTC/BTR/BTS compare + RMW patterns on very large integers (#165540)

This patch allows us to narrow single bit-test/twiddle operations for
larger than legal scalar integers to efficiently operate just on the i32
sub-integer block actually affected.

The BITOP(X,SHL(1,IDX)) patterns are split, with the IDX used to access
the specific i32 block as well as specific bit within that block.

BT comparisons are relatively simple, and builds on the truncated
shifted loads fold from #165266.

BTC/BTR/BTS bit twiddling patterns need to match the entire RMW pattern
to safely confirm only one block is affected, but a similar approach is
taken and creates codegen that should allow us to further merge with
matching BT opcodes in a future patch (see #165291).

The resulting codegen is notably more efficient than the heavily
micro-coded memory folded variants of BT/BTC/BTR/BTS.

There is still some work to improve the bit insert 'init' patterns
included in bittest-big-integer.ll but I'm expecting this to be a
straightforward future extension.

Fixes #164225



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list