diff options
author | Piyou Chen <piyou.chen@sifive.com> | 2023-07-26 22:04:33 -0700 |
---|---|---|
committer | Piyou Chen <piyou.chen@sifive.com> | 2023-08-04 00:39:25 -0700 |
commit | 2df05cd01c17f3ef720e554dc7cde43df27e5224 (patch) | |
tree | 45915c1f62f3e66a298991420a80bc751039c89a /clang/lib/Sema/SemaChecking.cpp | |
parent | b80ff2fec674b3db9ae0827c0ebd5dbbecbf1dbe (diff) | |
download | llvm-2df05cd01c17f3ef720e554dc7cde43df27e5224.zip llvm-2df05cd01c17f3ef720e554dc7cde43df27e5224.tar.gz llvm-2df05cd01c17f3ef720e554dc7cde43df27e5224.tar.bz2 |
[RISCV] Support overloaded version ntlh intrinsic function
Here is the proposal https://github.com/riscv-non-isa/riscv-c-api-doc/pull/47.
The version that omit the domain argument imply domain=__RISCV_NTLH_ALL.
```
type __riscv_ntl_load (type *ptr);
void __riscv_ntl_store (type *ptr, type val);
```
Reviewed By: kito-cheng, craig.topper
Differential Revision: https://reviews.llvm.org/D156221
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 502c583..dd08d75 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -5287,12 +5287,16 @@ bool Sema::CheckRISCVBuiltinFunctionCall(const TargetInfo &TI, bool IsStore = BuiltinID == RISCV::BI__builtin_riscv_ntl_store; unsigned NumArgs = IsStore ? 3 : 2; - if (checkArgCount(*this, TheCall, NumArgs)) + if (checkArgCountAtLeast(*this, TheCall, NumArgs - 1)) + return true; + + if (checkArgCountAtMost(*this, TheCall, NumArgs)) return true; // Domain value should be compile-time constant. // 2 <= domain <= 5 - if (SemaBuiltinConstantArgRange(TheCall, NumArgs - 1, 2, 5)) + if (TheCall->getNumArgs() == NumArgs && + SemaBuiltinConstantArgRange(TheCall, NumArgs - 1, 2, 5)) return true; Expr *PointerArg = TheCall->getArg(0); |