|
1 | 1 | ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
|
2 |
| -; RUN: llc -mtriple=riscv32 -mattr=+xmipscbop -mattr=+m -verify-machineinstrs < %s \ |
| 2 | +; RUN: llc -mtriple=riscv32 -mattr=+xmipscbop -verify-machineinstrs < %s \ |
3 | 3 | ; RUN: | FileCheck %s -check-prefix=RV32XMIPSPREFETCH
|
4 |
| -; RUN: llc -mtriple=riscv64 -mattr=+xmipscbop -mattr=+m -verify-machineinstrs < %s \ |
| 4 | +; RUN: llc -mtriple=riscv64 -mattr=+xmipscbop -verify-machineinstrs < %s \ |
5 | 5 | ; RUN: | FileCheck %s -check-prefix=RV64XMIPSPREFETCH
|
6 | 6 |
|
7 | 7 | define void @prefetch_data_read(ptr noundef %ptr) nounwind {
|
@@ -49,3 +49,54 @@ define void @prefetch_inst_read(ptr noundef %ptr) nounwind {
|
49 | 49 | tail call void @llvm.prefetch.p0(ptr nonnull %arrayidx, i32 0, i32 0, i32 0)
|
50 | 50 | ret void
|
51 | 51 | }
|
| 52 | + |
| 53 | +define void @prefetch_frameindex_test_neg() nounwind { |
| 54 | +; RV32XMIPSPREFETCH-LABEL: prefetch_frameindex_test_neg: |
| 55 | +; RV32XMIPSPREFETCH: # %bb.0: |
| 56 | +; RV32XMIPSPREFETCH-NEXT: lui a0, 1 |
| 57 | +; RV32XMIPSPREFETCH-NEXT: addi a0, a0, 16 |
| 58 | +; RV32XMIPSPREFETCH-NEXT: sub sp, sp, a0 |
| 59 | +; RV32XMIPSPREFETCH-NEXT: addi a0, sp, 524 |
| 60 | +; RV32XMIPSPREFETCH-NEXT: mips.pref 8, 0(a0) |
| 61 | +; RV32XMIPSPREFETCH-NEXT: lui a0, 1 |
| 62 | +; RV32XMIPSPREFETCH-NEXT: addi a0, a0, 16 |
| 63 | +; RV32XMIPSPREFETCH-NEXT: add sp, sp, a0 |
| 64 | +; RV32XMIPSPREFETCH-NEXT: ret |
| 65 | +; |
| 66 | +; RV64XMIPSPREFETCH-LABEL: prefetch_frameindex_test_neg: |
| 67 | +; RV64XMIPSPREFETCH: # %bb.0: |
| 68 | +; RV64XMIPSPREFETCH-NEXT: lui a0, 1 |
| 69 | +; RV64XMIPSPREFETCH-NEXT: addi a0, a0, 16 |
| 70 | +; RV64XMIPSPREFETCH-NEXT: sub sp, sp, a0 |
| 71 | +; RV64XMIPSPREFETCH-NEXT: addi a0, sp, 524 |
| 72 | +; RV64XMIPSPREFETCH-NEXT: mips.pref 8, 0(a0) |
| 73 | +; RV64XMIPSPREFETCH-NEXT: lui a0, 1 |
| 74 | +; RV64XMIPSPREFETCH-NEXT: addi a0, a0, 16 |
| 75 | +; RV64XMIPSPREFETCH-NEXT: add sp, sp, a0 |
| 76 | +; RV64XMIPSPREFETCH-NEXT: ret |
| 77 | + %data = alloca [1024 x i32], align 4 |
| 78 | + %ptr = getelementptr [1024 x i32], ptr %data, i32 0, i32 127 |
| 79 | + call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1) |
| 80 | + ret void |
| 81 | +} |
| 82 | + |
| 83 | +define void @prefetch_frameindex_test() nounwind { |
| 84 | +; RV32XMIPSPREFETCH-LABEL: prefetch_frameindex_test: |
| 85 | +; RV32XMIPSPREFETCH: # %bb.0: |
| 86 | +; RV32XMIPSPREFETCH-NEXT: addi sp, sp, -512 |
| 87 | +; RV32XMIPSPREFETCH-NEXT: mips.pref 8, 32(sp) |
| 88 | +; RV32XMIPSPREFETCH-NEXT: addi sp, sp, 512 |
| 89 | +; RV32XMIPSPREFETCH-NEXT: ret |
| 90 | +; |
| 91 | +; RV64XMIPSPREFETCH-LABEL: prefetch_frameindex_test: |
| 92 | +; RV64XMIPSPREFETCH: # %bb.0: |
| 93 | +; RV64XMIPSPREFETCH-NEXT: addi sp, sp, -512 |
| 94 | +; RV64XMIPSPREFETCH-NEXT: mips.pref 8, 32(sp) |
| 95 | +; RV64XMIPSPREFETCH-NEXT: addi sp, sp, 512 |
| 96 | +; RV64XMIPSPREFETCH-NEXT: ret |
| 97 | + %data = alloca [128 x i32], align 4 |
| 98 | + %base = bitcast ptr %data to ptr |
| 99 | + %ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 8 |
| 100 | + call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1) |
| 101 | + ret void |
| 102 | +} |
0 commit comments