[llvm] [GlobalISel][ARM] Legalization of G_CONSTANT using constant pool (PR #98308)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 11:27:31 PDT 2024


tschuett wrote:

AArch64 legalizes all constants:
```
 // Constants
  getActionDefinitionsBuilder(G_CONSTANT)
      .legalFor({p0, s8, s16, s32, s64})
      .widenScalarToNextPow2(0)
      .clampScalar(0, s8, s64);
  getActionDefinitionsBuilder(G_FCONSTANT)
      .legalIf([=](const LegalityQuery &Query) {
        const auto &Ty = Query.Types[0];
        if (HasFP16 && Ty == s16)
          return true;
        return Ty == s32 || Ty == s64 || Ty == s128;
      })
      .clampScalar(0, MinFPScalar, s128);
```

and selects all constants in the instruction selector:
https://github.com/llvm/llvm-project/blob/ee5d572718f7bb07f89b69df393b28a89033a5ca/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp#L2598

Why should ARM deviate from that model?

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


More information about the llvm-commits mailing list