[RISCV] Implement prefetch locality by NTLH
authorPiyou Chen <piyou.chen@sifive.com>
Mon, 17 Jul 2023 02:23:19 +0000 (19:23 -0700)
committerPiyou Chen <piyou.chen@sifive.com>
Mon, 17 Jul 2023 03:32:46 +0000 (20:32 -0700)
commit7ce4e933eab28d7a6b7a54ef96bee8853cc30bbc
tree19cfe12ff8ee9801be2ec81197e6f56bc6534b20
parentf3b4c266e8efa7828514e727061963d5510e81c9
[RISCV] Implement prefetch locality by NTLH

We add the MemOperand then backend will generate NTLH automatically.

```
__builtin_prefetch(ptr,  0 /* rw==read */, 0 /* locality */); => ntl.all + prefetch.r (ptr)
__builtin_prefetch(ptr,  0 /* rw==read */, 1 /* locality */); => ntl.pall + prefetch.r (ptr)
__builtin_prefetch(ptr,  0 /* rw==read */, 2 /* locality */); => ntl.p1 + prefetch.r (ptr)
__builtin_prefetch(ptr,  0 /* rw==read */, 3 /* locality */); => prefetch.r (ptr)
```

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D154691
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/test/CodeGen/RISCV/prefetch.ll