[clang] [clang][RISCV] support BITINT with mixed-type (PR #156592)
Piyou Chen via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 8 06:05:32 PDT 2025
================
@@ -680,14 +680,11 @@ ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType Ty, bool IsFixed,
if (const auto *ED = Ty->getAsEnumDecl())
Ty = ED->getIntegerType();
- // All integral types are promoted to XLen width
- if (Size < XLen && Ty->isIntegralOrEnumerationType()) {
- return extendType(Ty, CGT.ConvertType(Ty));
- }
-
if (const auto *EIT = Ty->getAs<BitIntType>()) {
- if (EIT->getNumBits() < XLen)
- return extendType(Ty, CGT.ConvertType(Ty));
+ // FIXME: Maybe we should treat 32 as a special case and wait for
+ // the SPEC to decide.
+ if (EIT->getNumBits() <= 2 * XLen)
+ return ABIArgInfo::getExtend(Ty, CGT.ConvertType(Ty));
if (EIT->getNumBits() > 128 ||
----------------
BeMg wrote:
I think it's fine. And after this patch, I only assume updating the signed/unsigned extension between 0 and 2×XLEN.
The other part match the following rule.
```
0~XLEN pass by value(reg)
XLEN~2xXLEN pass by value(reg pair)
> 2xXLEN pass be reference(mem)
```
cc @kito-cheng
https://github.com/llvm/llvm-project/pull/156592
More information about the cfe-commits
mailing list