This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Implement the vmmv.m/vmnot.m builtin.
ClosedPublic

Authored by HsiangKai on Apr 20 2021, 12:38 AM.

Diff Detail

Event Timeline

HsiangKai created this revision.Apr 20 2021, 12:38 AM
HsiangKai requested review of this revision.Apr 20 2021, 12:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2021, 12:38 AM

I can reproduce the crash above in my computer, so something is definitely off.

Looks like we emit this

case RISCV::BI__builtin_rvv_vmmv_m_b8:                
case RISCV::BI__builtin_rvv_vmmv_m_b4:                
case RISCV::BI__builtin_rvv_vmmv_m_b2:                
case RISCV::BI__builtin_rvv_vmmv_m_b1:                
case RISCV::BI__builtin_rvv_vmmv_m_b16:               
case RISCV::BI__builtin_rvv_vmmv_m_b32:               
case RISCV::BI__builtin_rvv_vmmv_m_b64:               
case RISCV::BI__builtin_rvv_vmand_mm_b8:              
case RISCV::BI__builtin_rvv_vmand_mm_b4:              
case RISCV::BI__builtin_rvv_vmand_mm_b2:              
case RISCV::BI__builtin_rvv_vmand_mm_b1:              
case RISCV::BI__builtin_rvv_vmand_mm_b16:             
case RISCV::BI__builtin_rvv_vmand_mm_b32:             
case RISCV::BI__builtin_rvv_vmand_mm_b64:             
  ID = Intrinsic::riscv_vmand;                        
  IntrinsicTypes = {ResultType, Ops[2]->getType()};   
  break;

But Ops has size 2 so this is accessing past the end. I observed the crash with clang::RISCV::BI__builtin_rvv_vmmv_m_b1 but I assume it happens with the other ones as well.

I think the description of the builtin should be def : RVVBuiltin<"m", "m", type_range>; as these are like unary operations, aren't they?

I can reproduce the crash above in my computer, so something is definitely off.

Looks like we emit this

case RISCV::BI__builtin_rvv_vmmv_m_b8:                
case RISCV::BI__builtin_rvv_vmmv_m_b4:                
case RISCV::BI__builtin_rvv_vmmv_m_b2:                
case RISCV::BI__builtin_rvv_vmmv_m_b1:                
case RISCV::BI__builtin_rvv_vmmv_m_b16:               
case RISCV::BI__builtin_rvv_vmmv_m_b32:               
case RISCV::BI__builtin_rvv_vmmv_m_b64:               
case RISCV::BI__builtin_rvv_vmand_mm_b8:              
case RISCV::BI__builtin_rvv_vmand_mm_b4:              
case RISCV::BI__builtin_rvv_vmand_mm_b2:              
case RISCV::BI__builtin_rvv_vmand_mm_b1:              
case RISCV::BI__builtin_rvv_vmand_mm_b16:             
case RISCV::BI__builtin_rvv_vmand_mm_b32:             
case RISCV::BI__builtin_rvv_vmand_mm_b64:             
  ID = Intrinsic::riscv_vmand;                        
  IntrinsicTypes = {ResultType, Ops[2]->getType()};   
  break;

But Ops has size 2 so this is accessing past the end. I observed the crash with clang::RISCV::BI__builtin_rvv_vmmv_m_b1 but I assume it happens with the other ones as well.

I think the description of the builtin should be def : RVVBuiltin<"m", "m", type_range>; as these are like unary operations, aren't they?

The fix is put in https://reviews.llvm.org/D100819#inline-952584. I will land D100819 today.

Rebase.

Thanks, I had missed that and my comment above was wrong.

Rebase.

Thanks, I had missed that and my comment above was wrong.

That's fine. Thanks for your review.

khchen accepted this revision.Apr 25 2021, 8:17 PM

LGTM.

This revision is now accepted and ready to land.Apr 25 2021, 8:17 PM
This revision was automatically updated to reflect the committed changes.