[all-commits] [llvm/llvm-project] 641d2e: [X86] Clamp large constant shift amounts for MMX s...

topperc via All-commits all-commits at lists.llvm.org
Wed Nov 6 13:03:45 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 641d2e5232b423a7dd81afac94dd3db4412a4971
      https://github.com/llvm/llvm-project/commit/641d2e5232b423a7dd81afac94dd3db4412a4971
  Author: Craig Topper <craig.topper at intel.com>
  Date:   2019-11-06 (Wed, 06 Nov 2019)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/mmx-arith.ll

  Log Message:
  -----------
  [X86] Clamp large constant shift amounts for MMX shift intrinsics to 8-bits.

The MMX intrinsics for shift by immediate take a 32-bit shift
amount but the hardware for shifting by immediate only encodes
8-bits. For the intrinsic we don't require the shift amount to
fit in 8-bits in the frontend because we don't check that its an
immediate in the frontend. If its is not an immediate we move it
to an MMX register and use the shift by register.

But if it is an immediate we'll use the shift by immediate
instruction. But we need to change the shift amount to 8-bits.
We were previously doing this accidentally by masking it in the
encoder. But this can make a large shift amount into a small
in bounds shift amount. Instead we should clamp larger shift
amounts to 255 so that the they don't become in bounds.

Fixes PR43922




More information about the All-commits mailing list