[all-commits] [llvm/llvm-project] 54dca1: [x86][GlobalISel] Select MOV32ri64 for unsigned 32...

Levi Laine via All-commits all-commits at lists.llvm.org
Sat Mar 14 05:45:03 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 54dca1e43166067a03c8b82e03df32ae2b12ccf8
      https://github.com/llvm/llvm-project/commit/54dca1e43166067a03c8b82e03df32ae2b12ccf8
  Author: Levi Laine <61821471+levish0 at users.noreply.github.com>
  Date:   2026-03-14 (Sat, 14 Mar 2026)

  Changed paths:
    M llvm/lib/Target/X86/GISel/X86InstructionSelector.cpp
    M llvm/test/CodeGen/X86/GlobalISel/constant.ll
    M llvm/test/CodeGen/X86/GlobalISel/select-constant.mir

  Log Message:
  -----------
  [x86][GlobalISel] Select MOV32ri64 for unsigned 32-bit i64 constants (#185182)

x86 GlobalISel currently selects `MOV64ri32` for signed 32-bit `i64`
constants and falls back to `MOV64ri` otherwise.
That misses the unsigned 32-bit case, where `MOV32ri64` is a better
match.
FastISel already handles this case by using `MOV32ri64` for
zero-extended
32-bit values.
Update `X86InstructionSelector::selectConstant()` to select `MOV32ri64`
for `i64` constants that fit in `uint32_t`, while keeping `MOV64ri32`
for signed 32-bit values and `MOV64ri` for larger constants.
This reduces the encoding size for these constants and fixes the
`0xffffffff` boundary case to use the correct zero-extending move.



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