[all-commits] [llvm/llvm-project] 8a3950: [RISCV] Support scalar/fix-length vector NTLH intr...

Piyou Chen via All-commits all-commits at lists.llvm.org
Mon Apr 24 20:20:15 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a3950510f819308f7ead16c339484147c69c84a
      https://github.com/llvm/llvm-project/commit/8a3950510f819308f7ead16c339484147c69c84a
  Author: Piyou Chen <piyou.chen at sifive.com>
  Date:   2023-04-24 (Mon, 24 Apr 2023)

  Changed paths:
    M clang/include/clang/Basic/BuiltinsRISCV.def
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/Headers/CMakeLists.txt
    A clang/lib/Headers/riscv_ntlh.h
    M clang/lib/Sema/SemaChecking.cpp
    A clang/test/CodeGen/RISCV/ntlh-intrinsics/riscv32-zihintntl.c
    M llvm/include/llvm/CodeGen/TargetLowering.h
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.h
    M llvm/lib/Target/RISCV/RISCVInsertNTLHInsts.cpp
    M llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
    M llvm/lib/Target/RISCV/RISCVInstrInfo.h
    M llvm/lib/Target/RISCV/RISCVInstrInfoZihintntl.td
    M llvm/test/CodeGen/RISCV/nontemporal-scalable.ll
    M llvm/test/CodeGen/RISCV/nontemporal.ll

  Log Message:
  -----------
  [RISCV] Support scalar/fix-length vector NTLH intrinsic with different domain

This commit implements the two NTLH intrinsic functions.

```
type __riscv_ntl_load (type *ptr, int domain);
void __riscv_ntl_store (type *ptr, type val, int domain);

```

```
enum {
  __RISCV_NTLH_INNERMOST_PRIVATE = 2,
  __RISCV_NTLH_ALL_PRIVATE,
  __RISCV_NTLH_INNERMOST_SHARED,
  __RISCV_NTLH_ALL
};
```

We encode the non-temporal domain into MachineMemOperand flags.

1. Create the RISC-V built-in function with custom semantic checking.
2. Assume the domain argument is a compile time constant,
and make it as LLVM IR metadata (nontemp_node).
3. Encode domain value as two bits MachineMemOperand TargetMMOflag.
4. According to MachineMemOperand TargetMMOflag, select corrsponding ntlh instruction.

Currently, it supports scalar type and fixed-length vector type.

Reviewed By: craig.topper

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




More information about the All-commits mailing list