[clang] [AIX] recognize vsr in inline asm for AIX (PR #68476)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 10 22:00:55 PDT 2023


================
@@ -807,7 +807,7 @@ ArrayRef<TargetInfo::GCCRegAlias> PPCTargetInfo::getGCCRegAliases() const {
 // PPC ELFABIv2 DWARF Definitoin "Table 2.26. Mappings of Common Registers".
 // vs0 ~ vs31 is mapping to 32 - 63,
 // vs32 ~ vs63 is mapping to 77 - 108.
----------------
hubert-reinterpretcast wrote:

> I prefer to solve this in another patch with solution: for targets that have no canonical name for physically overlapping registers, `ReturnCanonical` should always be false.
> 
> What do you think?

I think the usage of `ReturnCanonical` is at least partially intended (and applies to the situation with vs0 -> f0). In particular, it is intended to diagnose (as GCC does):
```
void f(void) {
  register float f __asm__("fr1");
  __asm__ __volatile__ (
    "fmul %0,%0,%0"
    :
    : "f"(f)
    : "vs1"
  );
}
```

That diagnostic does not seem to operate for Clang (at least for PPC) even with a simpler case where the clobber is `fr1` though.

I think we can leave that for later. For now, with the current patch, I think a comment to say that these numbers are used for indexing into the `GCCRegNames` array would be correct. If you believe that is a problem, then an additional FIXME comment can be added.

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


More information about the cfe-commits mailing list