[clang] [clang] Fix complex rvalue inputs to inline assembly (PR #239874)

Adityajyoti Kar via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 7 03:07:58 PST 2026


GiTaDi-CrEaTe wrote:

### Consider using `TEK_Complex` for consistency

In Clang CodeGen, evaluation kinds are typically queried via:

```cpp
getEvaluationKind(InputExpr->getType()) == TEK_Complex
```

(matching `hasScalarEvaluationKind` checked earlier in `EmitAsmInput`). Using `getEvaluationKind` also handles atomic complex types like `_Atomic(_Complex float)`, where `isAnyComplexType()` returns false on the canonical `AtomicType`.

---

### Test coverage for `_Complex double` (> 64-bit) and `"m"` constraints

`_Complex float` fits in a 64-bit integer register on x86_64, so it takes the direct scalarized load path in `EmitAsmInputLValue`. It would be great to also add test cases for:

* **`_Complex double` (Size == 128)**, which exercises the `Size > 64` fallback path in `EmitAsmInputLValue` that converts the register constraint into an indirect pointer operand (`*r`).
* **Memory constraints** like `"m"(a + b)`.


https://github.com/llvm/llvm-project/pull/239874


More information about the cfe-commits mailing list