[all-commits] [llvm/llvm-project] cf40b8: [RISCV] Pass vector argument by stack correctly.

Kito Cheng via All-commits all-commits at lists.llvm.org
Wed Mar 15 02:23:04 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cf40b8a4dd3db7370f4cde8415a05eed07ba711a
      https://github.com/llvm/llvm-project/commit/cf40b8a4dd3db7370f4cde8415a05eed07ba711a
  Author: Kito Cheng <kito.cheng at sifive.com>
  Date:   2023-03-15 (Wed, 15 Mar 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/calling-conv-vector-on-stack.ll

  Log Message:
  -----------
  [RISCV] Pass vector argument by stack correctly.

We've a argument lowering logic to prevent floating-point value pass
passed with bit-conversion, but that rule should not applied to vector
arguments.

---

How to pass argument to `foo`:

```
tail call void @foo(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
                    <vscale x 16 x float> zeroinitializer,
                    <vscale x 16 x float> zeroinitializer,
                    <vscale x 16 x float> zeroinitializer)
```

`foo` take 13 arguments, first 8 argument pass in GPR, and next 2 LMUL 8 vector
arguments passed in v8-v23, and now we run out of argument register for GPR and
vector register, so we must pass last LMUL 8 vector argument by stack.

Which means we should reserve `vlenb * 8` byte for stack for the last
vector argument.

Reviewed By: craig.topper, asb

Differential Revision: https://reviews.llvm.org/D145938




More information about the All-commits mailing list