[llvm-bugs] [Bug 34042] New: [X86] Unnecessary sign extension in bextr second arg

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 3 05:16:01 PDT 2017


            Bug ID: 34042
           Summary: [X86] Unnecessary sign extension in bextr second arg
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    spatel+llvm at rotateright.com

#include <stdint.h>
uint64_t bextr64_demanded(uint64_t a, int32_t b)
    return __builtin_ia32_bextr_u64(a, b);

define i64 @bextr64_demanded(i64, i32) {
  %3 = sext i32 %1 to i64
  %4 = tail call i64 @llvm.x86.bmi.bextr.64(i64 %0, i64 %3)
  ret i64 %4
declare i64 @llvm.x86.bmi.bextr.64(i64, i64)

  movslq %esi, %rax
  bextrq %rax, %rdi, %rax

As only the bottom 16 bits of the second argument is needed for BEXTR we are
performing an unnecessary sign extension.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170803/94e414f5/attachment.html>

More information about the llvm-bugs mailing list