aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authoreopXD <yueh.ting.chen@gmail.com>2023-04-10 00:18:34 -0700
committereopXD <yueh.ting.chen@gmail.com>2023-05-22 04:29:28 -0700
commit6a097e279c7831d12e9ed56ca5cc021e68315c12 (patch)
treecbedc684848cd4ebde67f1ae7b321c9658101ab0 /clang/lib/Sema/SemaChecking.cpp
parent5eb1b1fc1f889f22792d937b57cccaee06771797 (diff)
downloadllvm-6a097e279c7831d12e9ed56ca5cc021e68315c12.zip
llvm-6a097e279c7831d12e9ed56ca5cc021e68315c12.tar.gz
llvm-6a097e279c7831d12e9ed56ca5cc021e68315c12.tar.bz2
[10/11][POC][Clang][RISCV] Define vget for tuple type
For the cover letter of this patch-set, please checkout D146872. Depends on D147915. This is the 10th patch of the patch-set. This patch is a proof-of-concept and will be extended to full coverage in the future. Only vget for tuple type of NF=2, EEW=32, LMUL=1 is defined now. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D147916
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 06739be..7aceade 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4522,9 +4522,12 @@ bool Sema::CheckRISCVBuiltinFunctionCall(const TargetInfo &TI,
ASTContext::BuiltinVectorTypeInfo VecInfo =
Context.getBuiltinVectorTypeInfo(cast<BuiltinType>(
TheCall->getArg(0)->getType().getCanonicalType().getTypePtr()));
- unsigned MaxIndex =
- (VecInfo.EC.getKnownMinValue() * VecInfo.NumVectors) /
- (ResVecInfo.EC.getKnownMinValue() * ResVecInfo.NumVectors);
+ unsigned MaxIndex;
+ if (VecInfo.NumVectors != 1) // vget for tuple type
+ MaxIndex = VecInfo.NumVectors;
+ else // vget for non-tuple type
+ MaxIndex = (VecInfo.EC.getKnownMinValue() * VecInfo.NumVectors) /
+ (ResVecInfo.EC.getKnownMinValue() * ResVecInfo.NumVectors);
return SemaBuiltinConstantArgRange(TheCall, 1, 0, MaxIndex - 1);
}
case RISCVVector::BI__builtin_rvv_vset_v: {