[PATCH] D25438: [mips] Fix Mips MSA instrinsics

Vasileios Kalintiris via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 09:13:03 PDT 2016

vkalintiris added a comment.

In https://reviews.llvm.org/D25438#576494, @sdardis wrote:

> From immediates-bad.ll:
>   define void @addvi_d(<2 x i64> * %ptr) {
>   entry:
>   ; CHECK-LABEL: addvi_d:
>   ; CHECK: addv.d
>     %a = load <2 x i64>, <2 x i64> * %ptr, align 16
>     %r = call <2 x i64> @llvm.mips.addvi.d(<2 x i64> %a, i32 65)
>     store <2 x i64> %r, <2 x i64> * %ptr, align 16
>     ret void
>   }
> will crash LLVM. Dump from llc:
>   Assertion failed: (width > BitWidth && "Invalid APInt ZeroExtend request"), function zext, file /Users/simon/dev/llvm/llvm2/llvm/lib/Support/APInt.cpp, line 981.
>   Stack dump:
>   0.	Program arguments: /Users/simon/dev/llvm/llvm2/llvmgitsvnbuild/./bin/llc -march=mips -mattr=+msa,+fp64 -relocation-model=pic 
>   1.	Running pass 'Function Pass Manager' on module '<stdin>'.
>   2.	Running pass 'MIPS DAG->DAG Pattern Instruction Selection' on function '@addvi_d'
> As you can seeI think there may be another solution though, which is to constrain the type of the immediate operand down to things like i5. I would have to reinvestigate.

That's weird, it compiles fine for me with r284832:

  vk at nx9420 $ ninja -C /home/vk/build/llvm/debug/ && llc -march=mips -mattr=+msa,+fp64 -relocation-model=pic <./tmp.ll
  ninja: Entering directory `/home/vk/build/llvm/debug/'
  ninja: no work to do.
        .section        .mdebug.abi32,"", at progbits
        .nan    legacy
        .module fp=64
        .file   "<stdin>"
        .globl  addvi_d
        .p2align        2
        .type   addvi_d, at function
        .set    nomicromips
        .set    nomips16
        .ent    addvi_d
  addvi_d:                                # @addvi_d
        .frame  $sp,0,$ra
        .mask   0x00000000,0
        .fmask  0x00000000,0
        .set    noreorder
        .set    nomacro
        .set    noat
  # BB#0:                                 # %entry
        ldi.d   $w0, 65
        shf.w   $w0, $w0, 177
        ld.d    $w1, 0($4)
        addv.d  $w0, $w1, $w0
        jr      $ra
        st.d    $w0, 0($4)
        .set    at
        .set    macro
        .set    reorder
        .end    addvi_d
        .size   addvi_d, ($func_end0)-addvi_d
        .section        ".note.GNU-stack","", at progbits



More information about the llvm-commits mailing list