https://bugs.llvm.org/show_bug.cgi?id=44915

            Bug ID: 44915
           Summary: extractelement on <5 x i3> always returns zeroth
                    element
           Product: libraries
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedb...@nondot.org
          Reporter: l...@henning-thielemann.de
                CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
                    llvm-...@redking.me.uk, spatel+l...@rotateright.com

$ cat extract.ll
target triple = "x86_64-pc-linux-gnu"

define i32 @extract3(i15*, i32) {
_L1:
  %2 = load i15, i15* %0
  %3 = bitcast i15 %2 to <5 x i3>
  %4 = extractelement <5 x i3> %3, i32 %1
  %5 = zext i3 %4 to i32
  ret i32 %5
}

$ llc-9 <extract.ll
        .text
        .file   "<stdin>"
        .globl  extract3                # -- Begin function extract3
        .p2align        4, 0x90
        .type   extract3,@function
extract3:                               # @extract3
        .cfi_startproc
# %bb.0:                                # %_L1
                                        # kill: def $esi killed $esi def $rsi
        movzbl  (%rdi), %eax
        movd    %eax, %xmm0
        pinsrw  $1, %eax, %xmm0
        pinsrw  $2, %eax, %xmm0
        pinsrw  $3, %eax, %xmm0
        pinsrw  $4, %eax, %xmm0
        movdqa  %xmm0, -24(%rsp)
        andl    $7, %esi
        movzwl  -24(%rsp,%rsi,2), %eax
        andl    $7, %eax
        retq
.Lfunc_end0:
        .size   extract3, .Lfunc_end0-extract3
        .cfi_endproc
                                        # -- End function

        .section        ".note.GNU-stack","",@progbits



It seems there are some shifts and masks missing.
And if it would shift and mask it do not need to roundtrip through xmm0.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to