[all-commits] [llvm/llvm-project] 8ccb18: [IR] Implementation and lowering of `bitinsert` an...

Pedro Vicente via All-commits all-commits at lists.llvm.org
Fri Sep 25 08:36:34 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ccb1826dad0257eda59d88b5fd35a0bc3b933f8
      https://github.com/llvm/llvm-project/commit/8ccb1826dad0257eda59d88b5fd35a0bc3b933f8
  Author: Pedro Vicente <pmadcv at gmail.com>
  Date:   2026-09-25 (Fri, 25 Sep 2026)

  Changed paths:
    M llvm/docs/LangRef.md
    M llvm/docs/ReleaseNotes.md
    M llvm/include/llvm-c/Core.h
    M llvm/include/llvm/Analysis/InstSimplifyFolder.h
    M llvm/include/llvm/Analysis/TargetFolder.h
    M llvm/include/llvm/AsmParser/LLParser.h
    M llvm/include/llvm/AsmParser/LLToken.h
    M llvm/include/llvm/Bitcode/LLVMBitCodes.h
    M llvm/include/llvm/IR/ConstantFolder.h
    M llvm/include/llvm/IR/IRBuilder.h
    M llvm/include/llvm/IR/IRBuilderFolder.h
    M llvm/include/llvm/IR/InstVisitor.h
    M llvm/include/llvm/IR/Instruction.def
    M llvm/include/llvm/IR/Instructions.h
    M llvm/include/llvm/IR/NoFolder.h
    M llvm/lib/AsmParser/LLLexer.cpp
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
    M llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
    M llvm/lib/CodeGen/TargetLoweringBase.cpp
    M llvm/lib/IR/AsmWriter.cpp
    M llvm/lib/IR/Core.cpp
    M llvm/lib/IR/Instruction.cpp
    M llvm/lib/IR/Instructions.cpp
    M llvm/lib/IR/Verifier.cpp
    M llvm/test/Analysis/IR2Vec/Inputs/reference_default_vocab_print.txt
    M llvm/test/Analysis/IR2Vec/Inputs/reference_wtd1_vocab_print.txt
    M llvm/test/Analysis/IR2Vec/Inputs/reference_wtd2_vocab_print.txt
    A llvm/test/Assembler/bitinsert-bitextract-invalid.ll
    A llvm/test/Assembler/bitinsert-bitextract.ll
    M llvm/test/Bitcode/compatibility.ll
    A llvm/test/CodeGen/AArch64/bitinsert-bitextract-common-offsets.ll
    A llvm/test/CodeGen/AArch64/bitinsert-bitextract-fp.ll
    A llvm/test/CodeGen/AArch64/bitinsert-bitextract.ll
    A llvm/test/CodeGen/AMDGPU/bitinsert-bitextract-common-offsets.ll
    A llvm/test/CodeGen/AMDGPU/bitinsert-bitextract-fp.ll
    A llvm/test/CodeGen/AMDGPU/bitinsert-bitextract.ll
    A llvm/test/CodeGen/ARM/bitinsert-bitextract-common-offsets.ll
    A llvm/test/CodeGen/ARM/bitinsert-bitextract-fp.ll
    A llvm/test/CodeGen/ARM/bitinsert-bitextract.ll
    A llvm/test/CodeGen/PowerPC/bitinsert-bitextract-common-offsets.ll
    A llvm/test/CodeGen/PowerPC/bitinsert-bitextract-fp.ll
    A llvm/test/CodeGen/PowerPC/bitinsert-bitextract.ll
    A llvm/test/CodeGen/RISCV/bitinsert-bitextract-common-offsets.ll
    A llvm/test/CodeGen/RISCV/bitinsert-bitextract-fp.ll
    A llvm/test/CodeGen/RISCV/bitinsert-bitextract.ll
    A llvm/test/CodeGen/X86/GlobalISel/bitinsert-bitextract.ll
    A llvm/test/CodeGen/X86/bitinsert-bitextract-common-offsets.ll
    A llvm/test/CodeGen/X86/bitinsert-bitextract-fp.ll
    A llvm/test/CodeGen/X86/bitinsert-bitextract.ll
    A llvm/test/Verifier/bitextract-bitinsert-invalid-verifier.ll
    M llvm/test/tools/llvm-ir2vec/entities.ll
    M llvm/test/tools/llvm-ir2vec/triplets.ll
    M llvm/tools/llvm-c-test/echo.cpp
    M llvm/unittests/Analysis/IR2VecTest.cpp

  Log Message:
  -----------
  [IR] Implementation and lowering of `bitinsert` and `bitextract` (#200605)

This PR introduces `bitinsert` and `bitextract` instructions for LLVM
IR. These allow bit manipulation for byte types. Both were lowered to
GlobalIsel and SDag.

Tests were added for AArch64, AMDGPU, ARM, PowerPC, RISCV, x86 and LLVM
IR.

The LangRef was updated to document the new instructions.

The lowering of `bitextract` and `bitinsert` instructions are
implemented using integer operations.
In order to obtain the results for `bitextract`, a shift right
instruction with a specific offset is used (that can be a variable or an
immediate).
Relative to floating-point, in `bitinsert`, we reinterpret the bits of
the floating-point value as if it is an integer.

Pointer operands and results are reinterpreted as if by bitcast, as
specified in the LangRef.

This PR is based on the RFC:
https://discourse.llvm.org/t/rfc-bitinsert-and-bitextract-instructions-for-llvm-ir-2/90764



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