Alex Bradbury 3d2650bdeb
[RISCV] Use addi rather than addiw for immediates materialised by lui+addi(w) pairs when possible (#141663)
The logic in RISCVMatInt would previously produce lui+addiw on RV64
whenever a 32-bit integer must be materialised and the Hi20 and Lo12
parts are non-zero. However, sometimes addi can be used equivalently
(whenever the sign extension behaviour of addiw would be a no-op). This
patch moves to using addiw only when necessary. Although there is
absolutely no advantage in terms of compressibility or performance, this
has the following advantages:
* It's more consistent with logic used elsewhere in the backend. For
instance, RISCVOptWInstrs will try to convert addiw to addi on the basis
it reduces test diffs vs RV32.
* This matches the lowering GCC does in its codegen path. Unlike LLVM,
GCC seems to have different expansion logic for the assembler vs
codegen. For codegen it will use lui+addi if possible, but expanding
`li` in the assembler will always produces lui+addiw as LLVM did prior
to this commit. As someone who has been looking at a lot of gcc vs clang
diffs lately, reducing unnecessary divergence is of at least some value.
* As the diff for fold-mem-offset.ll shows, we can fold memory offsets
in more cases when addi is used. Memory offset folding could be taught
to recognise when the addiw could be replaced with an addi, but that
seems unnecessary when we can simply change the logic in RISCVMatInt.

As pointed out by @topperc during review, making this change without
modifying RISCVOptWInstrs risks introducing some cases where we fail to
remove a sext.w that we removed before. I've incorporated a patch based
on a suggestion from Craig that avoids it, and also adds appropriate
RISCVOptWInstrs test cases.

The initial patch description noted that the main motivation was to
avoid unnecessary differences both for RV32/RV64 and when comparing GCC,
but noted that very occasionally we see a benefit from memory offset
folding kicking in when it didn't before. Looking at the dynamic
instruction count difference for SPEC benchmarks targeting rva22u64 and
it shows we actually get a meaningful
~4.3% reduction in dynamic icount for 519.lbm_r. Looking at the data
more closely, the codegen difference is in `LBM_performStreamCollideTRT`
which as a function accounts for ~98% for dynamically executed
instructions and the codegen diffs appear to be a knock-on effect of the
address merging reducing register pressure right from function entry
(for instance, we get a big reduction in dynamically executed loads in
that function).

Below is the icount data (rva22u64 -O3, no LTO):
```
Benchmark                Baseline            This PR   Diff (%)
============================================================
500.perlbench_r         174116601991    174115795810     -0.00%
502.gcc_r               218903280858    218903215788     -0.00%
505.mcf_r               131208029185    131207692803     -0.00%
508.namd_r              217497594322    217497594297     -0.00%
510.parest_r            289314486153    289313577652     -0.00%
511.povray_r             30640531048     30640765701      0.00%
519.lbm_r                95897914862     91712688050     -4.36%
520.omnetpp_r           134641549722    134867015683      0.17%
523.xalancbmk_r         281462762992    281432092673     -0.01%
525.x264_r              379776121941    379535558210     -0.06%
526.blender_r           659736022025    659738387343      0.00%
531.deepsjeng_r         349122867552    349122867481     -0.00%
538.imagick_r           238558760552    238558753269     -0.00%
541.leela_r             406578560612    406385135260     -0.05%
544.nab_r               400997131674    400996765827     -0.00%
557.xz_r                130079522194    129945515709     -0.10%

```

The instcounting setup I use doesn't have good support for drilling down
into functions from outside the linked executable (e.g. libc). The
difference in omnetpp all seems to come from there, and does not reflect
any degradation in codegen quality.

I can confirm with the current version of the PR there is no change in
the number of static sext.w across all the SPEC 2017 benchmarks
(rva22u64 O3)

Co-authored-by: Craig Topper <craig.topper@sifive.com>
2025-06-02 22:24:50 +01:00

1560 lines
48 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV32I %s
; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV64I %s
; RUN: llc -mtriple=riscv32 -mattr=+zicbop -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV32ZICBOP %s
; RUN: llc -mtriple=riscv64 -mattr=+zicbop -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV64ZICBOP %s
; RUN: llc -mtriple=riscv64 -mattr=+zicbop,+zihintntl -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV64ZICBOPZIHINTNTL %s
declare void @llvm.prefetch(ptr, i32, i32, i32)
define void @test_prefetch_read_locality_0(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_read_locality_0:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_read_locality_0:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_read_locality_0:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_read_locality_0:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_read_locality_0:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_write_locality_0(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_write_locality_0:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_write_locality_0:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_write_locality_0:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.w 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_write_locality_0:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.w 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_write_locality_0:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.w 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 1, i32 0, i32 1)
ret void
}
define void @test_prefetch_instruction_locality_0(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_instruction_locality_0:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_instruction_locality_0:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_instruction_locality_0:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.i 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_instruction_locality_0:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.i 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_instruction_locality_0:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.i 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 0, i32 0, i32 0)
ret void
}
define void @test_prefetch_read_locality_1(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_read_locality_1:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_read_locality_1:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_read_locality_1:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_read_locality_1:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_read_locality_1:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.pall
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 0, i32 1, i32 1)
ret void
}
define void @test_prefetch_write_locality_1(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_write_locality_1:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_write_locality_1:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_write_locality_1:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.w 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_write_locality_1:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.w 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_write_locality_1:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.pall
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.w 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 1, i32 1, i32 1)
ret void
}
define void @test_prefetch_instruction_locality_1(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_instruction_locality_1:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_instruction_locality_1:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_instruction_locality_1:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.i 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_instruction_locality_1:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.i 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_instruction_locality_1:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.pall
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.i 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 0, i32 1, i32 0)
ret void
}
define void @test_prefetch_read_locality_2(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_read_locality_2:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_read_locality_2:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_read_locality_2:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_read_locality_2:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_read_locality_2:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.p1
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 0, i32 2, i32 1)
ret void
}
define void @test_prefetch_write_locality_2(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_write_locality_2:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_write_locality_2:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_write_locality_2:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.w 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_write_locality_2:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.w 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_write_locality_2:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.p1
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.w 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 1, i32 2, i32 1)
ret void
}
define void @test_prefetch_instruction_locality_2(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_instruction_locality_2:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_instruction_locality_2:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_instruction_locality_2:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.i 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_instruction_locality_2:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.i 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_instruction_locality_2:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.p1
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.i 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 0, i32 2, i32 0)
ret void
}
define void @test_prefetch_read_locality_3(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_read_locality_3:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_read_locality_3:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_read_locality_3:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_read_locality_3:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_read_locality_3:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 0, i32 3, i32 1)
ret void
}
define void @test_prefetch_write_locality_3(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_write_locality_3:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_write_locality_3:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_write_locality_3:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.w 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_write_locality_3:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.w 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_write_locality_3:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.w 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 1, i32 3, i32 1)
ret void
}
define void @test_prefetch_instruction_locality_3(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_instruction_locality_3:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_instruction_locality_3:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_instruction_locality_3:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.i 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_instruction_locality_3:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.i 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_instruction_locality_3:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.i 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
call void @llvm.prefetch(ptr %a, i32 0, i32 3, i32 0)
ret void
}
define void @test_prefetch_offsetable_0(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_offsetable_0:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_offsetable_0:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_offsetable_0:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.r 2016(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_offsetable_0:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.r 2016(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_offsetable_0:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 2016(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%addr = getelementptr i8, ptr %a, i64 2016
call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_offsetable_1(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_offsetable_1:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_offsetable_1:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_offsetable_1:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.r -2048(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_offsetable_1:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.r -2048(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_offsetable_1:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r -2048(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%addr = getelementptr i8, ptr %a, i64 -2048
call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_offsetable_2(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_offsetable_2:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_offsetable_2:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_offsetable_2:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.r 32(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_offsetable_2:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.r 32(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_offsetable_2:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 32(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%addr = getelementptr i8, ptr %a, i64 32
call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_offsetable_3(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_offsetable_3:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_offsetable_3:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_offsetable_3:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: prefetch.r -32(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_offsetable_3:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: prefetch.r -32(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_offsetable_3:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r -32(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%addr = getelementptr i8, ptr %a, i64 -32
call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_offsetable_4(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_offsetable_4:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_offsetable_4:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_offsetable_4:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi a0, a0, 32
; RV32ZICBOP-NEXT: prefetch.r 2016(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_offsetable_4:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi a0, a0, 32
; RV64ZICBOP-NEXT: prefetch.r 2016(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_offsetable_4:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, 32
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 2016(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%addr = getelementptr i8, ptr %a, i64 2048
call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_offsetable_5(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_offsetable_5:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_offsetable_5:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_offsetable_5:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi a0, a0, -1
; RV32ZICBOP-NEXT: prefetch.r -2048(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_offsetable_5:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi a0, a0, -1
; RV64ZICBOP-NEXT: prefetch.r -2048(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_offsetable_5:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, -1
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r -2048(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%addr = getelementptr i8, ptr %a, i64 -2049
call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_offsetable_6(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_offsetable_6:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_offsetable_6:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_offsetable_6:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi a0, a0, 16
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_offsetable_6:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi a0, a0, 16
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_offsetable_6:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, 16
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%addr = getelementptr i8, ptr %a, i64 16
call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_offsetable_7(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_offsetable_7:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_offsetable_7:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_offsetable_7:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi a0, a0, -16
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_offsetable_7:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi a0, a0, -16
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_offsetable_7:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, -16
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%addr = getelementptr i8, ptr %a, i64 -16
call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_offsetable_9(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_offsetable_9:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_offsetable_9:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_offsetable_9:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a1, 1
; RV32ZICBOP-NEXT: add a0, a0, a1
; RV32ZICBOP-NEXT: prefetch.r 64(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_offsetable_9:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a1, 1
; RV64ZICBOP-NEXT: add a0, a0, a1
; RV64ZICBOP-NEXT: prefetch.r 64(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_offsetable_9:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a1, 1
; RV64ZICBOPZIHINTNTL-NEXT: add a0, a0, a1
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 64(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%addr = getelementptr i8, ptr %a, i64 4160
call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_offsetable_8(ptr %a) nounwind {
; RV32I-LABEL: test_prefetch_offsetable_8:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_offsetable_8:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_offsetable_8:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a1, 1048575
; RV32ZICBOP-NEXT: add a0, a0, a1
; RV32ZICBOP-NEXT: prefetch.r -64(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_offsetable_8:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a1, 1048575
; RV64ZICBOP-NEXT: add a0, a0, a1
; RV64ZICBOP-NEXT: prefetch.r -64(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_offsetable_8:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a1, 1048575
; RV64ZICBOPZIHINTNTL-NEXT: add a0, a0, a1
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r -64(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%addr = getelementptr i8, ptr %a, i64 -4160
call void @llvm.prefetch(ptr %addr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_frameindex_0() nounwind {
; RV32I-LABEL: test_prefetch_frameindex_0:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -512
; RV32I-NEXT: addi sp, sp, 512
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_frameindex_0:
; RV64I: # %bb.0:
; RV64I-NEXT: addi sp, sp, -512
; RV64I-NEXT: addi sp, sp, 512
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_frameindex_0:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi sp, sp, -512
; RV32ZICBOP-NEXT: prefetch.r 0(sp)
; RV32ZICBOP-NEXT: addi sp, sp, 512
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_frameindex_0:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi sp, sp, -512
; RV64ZICBOP-NEXT: prefetch.r 0(sp)
; RV64ZICBOP-NEXT: addi sp, sp, 512
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_frameindex_0:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, -512
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(sp)
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, 512
; RV64ZICBOPZIHINTNTL-NEXT: ret
%data = alloca [128 x i32], align 4
%base = bitcast ptr %data to ptr
%ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 0
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_frameindex_1() nounwind {
; RV32I-LABEL: test_prefetch_frameindex_1:
; RV32I: # %bb.0:
; RV32I-NEXT: lui a0, 1
; RV32I-NEXT: addi a0, a0, 16
; RV32I-NEXT: sub sp, sp, a0
; RV32I-NEXT: lui a0, 1
; RV32I-NEXT: addi a0, a0, 16
; RV32I-NEXT: add sp, sp, a0
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_frameindex_1:
; RV64I: # %bb.0:
; RV64I-NEXT: lui a0, 1
; RV64I-NEXT: addi a0, a0, 16
; RV64I-NEXT: sub sp, sp, a0
; RV64I-NEXT: lui a0, 1
; RV64I-NEXT: addi a0, a0, 16
; RV64I-NEXT: add sp, sp, a0
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_frameindex_1:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, 1
; RV32ZICBOP-NEXT: addi a0, a0, 16
; RV32ZICBOP-NEXT: sub sp, sp, a0
; RV32ZICBOP-NEXT: addi a0, sp, 16
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: lui a0, 1
; RV32ZICBOP-NEXT: addi a0, a0, 16
; RV32ZICBOP-NEXT: add sp, sp, a0
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_frameindex_1:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, 1
; RV64ZICBOP-NEXT: addi a0, a0, 16
; RV64ZICBOP-NEXT: sub sp, sp, a0
; RV64ZICBOP-NEXT: addi a0, sp, 16
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: lui a0, 1
; RV64ZICBOP-NEXT: addi a0, a0, 16
; RV64ZICBOP-NEXT: add sp, sp, a0
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_frameindex_1:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, 1
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, 16
; RV64ZICBOPZIHINTNTL-NEXT: sub sp, sp, a0
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, sp, 16
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, 1
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, 16
; RV64ZICBOPZIHINTNTL-NEXT: add sp, sp, a0
; RV64ZICBOPZIHINTNTL-NEXT: ret
%data = alloca [1024 x i32], align 4
%ptr = bitcast ptr %data to ptr
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_frameindex_2() nounwind {
; RV32I-LABEL: test_prefetch_frameindex_2:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -512
; RV32I-NEXT: addi sp, sp, 512
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_frameindex_2:
; RV64I: # %bb.0:
; RV64I-NEXT: addi sp, sp, -512
; RV64I-NEXT: addi sp, sp, 512
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_frameindex_2:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi sp, sp, -512
; RV32ZICBOP-NEXT: addi a0, sp, 16
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: addi sp, sp, 512
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_frameindex_2:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi sp, sp, -512
; RV64ZICBOP-NEXT: addi a0, sp, 16
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: addi sp, sp, 512
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_frameindex_2:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, -512
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, sp, 16
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, 512
; RV64ZICBOPZIHINTNTL-NEXT: ret
%data = alloca [128 x i32], align 4
%base = bitcast ptr %data to ptr
%ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 4
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_frameindex_3() nounwind {
; RV32I-LABEL: test_prefetch_frameindex_3:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -512
; RV32I-NEXT: addi sp, sp, 512
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_frameindex_3:
; RV64I: # %bb.0:
; RV64I-NEXT: addi sp, sp, -512
; RV64I-NEXT: addi sp, sp, 512
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_frameindex_3:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi sp, sp, -512
; RV32ZICBOP-NEXT: addi a0, sp, -16
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: addi sp, sp, 512
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_frameindex_3:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi sp, sp, -512
; RV64ZICBOP-NEXT: addi a0, sp, -16
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: addi sp, sp, 512
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_frameindex_3:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, -512
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, sp, -16
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, 512
; RV64ZICBOPZIHINTNTL-NEXT: ret
%data = alloca [128 x i32], align 4
%base = bitcast ptr %data to ptr
%ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 -4
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_frameindex_4() nounwind {
; RV32I-LABEL: test_prefetch_frameindex_4:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -512
; RV32I-NEXT: addi sp, sp, 512
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_frameindex_4:
; RV64I: # %bb.0:
; RV64I-NEXT: addi sp, sp, -512
; RV64I-NEXT: addi sp, sp, 512
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_frameindex_4:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi sp, sp, -512
; RV32ZICBOP-NEXT: prefetch.r 32(sp)
; RV32ZICBOP-NEXT: addi sp, sp, 512
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_frameindex_4:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi sp, sp, -512
; RV64ZICBOP-NEXT: prefetch.r 32(sp)
; RV64ZICBOP-NEXT: addi sp, sp, 512
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_frameindex_4:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, -512
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 32(sp)
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, 512
; RV64ZICBOPZIHINTNTL-NEXT: ret
%data = alloca [128 x i32], align 4
%base = bitcast ptr %data to ptr
%ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 8
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_frameindex_5() nounwind {
; RV32I-LABEL: test_prefetch_frameindex_5:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -512
; RV32I-NEXT: addi sp, sp, 512
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_frameindex_5:
; RV64I: # %bb.0:
; RV64I-NEXT: addi sp, sp, -512
; RV64I-NEXT: addi sp, sp, 512
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_frameindex_5:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi sp, sp, -512
; RV32ZICBOP-NEXT: prefetch.r -32(sp)
; RV32ZICBOP-NEXT: addi sp, sp, 512
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_frameindex_5:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi sp, sp, -512
; RV64ZICBOP-NEXT: prefetch.r -32(sp)
; RV64ZICBOP-NEXT: addi sp, sp, 512
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_frameindex_5:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, -512
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r -32(sp)
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, 512
; RV64ZICBOPZIHINTNTL-NEXT: ret
%data = alloca [128 x i32], align 4
%base = bitcast ptr %data to ptr
%ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 -8
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_frameindex_6() nounwind {
; RV32I-LABEL: test_prefetch_frameindex_6:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -512
; RV32I-NEXT: addi sp, sp, 512
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_frameindex_6:
; RV64I: # %bb.0:
; RV64I-NEXT: addi sp, sp, -512
; RV64I-NEXT: addi sp, sp, 512
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_frameindex_6:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi sp, sp, -512
; RV32ZICBOP-NEXT: prefetch.r 2016(sp)
; RV32ZICBOP-NEXT: addi sp, sp, 512
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_frameindex_6:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi sp, sp, -512
; RV64ZICBOP-NEXT: prefetch.r 2016(sp)
; RV64ZICBOP-NEXT: addi sp, sp, 512
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_frameindex_6:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, -512
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 2016(sp)
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, 512
; RV64ZICBOPZIHINTNTL-NEXT: ret
%data = alloca [128 x i32], align 4
%base = bitcast ptr %data to ptr
%ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 504
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_frameindex_7() nounwind {
; RV32I-LABEL: test_prefetch_frameindex_7:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -512
; RV32I-NEXT: addi sp, sp, 512
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_frameindex_7:
; RV64I: # %bb.0:
; RV64I-NEXT: addi sp, sp, -512
; RV64I-NEXT: addi sp, sp, 512
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_frameindex_7:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi sp, sp, -512
; RV32ZICBOP-NEXT: prefetch.r -2048(sp)
; RV32ZICBOP-NEXT: addi sp, sp, 512
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_frameindex_7:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi sp, sp, -512
; RV64ZICBOP-NEXT: prefetch.r -2048(sp)
; RV64ZICBOP-NEXT: addi sp, sp, 512
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_frameindex_7:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, -512
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r -2048(sp)
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, 512
; RV64ZICBOPZIHINTNTL-NEXT: ret
%data = alloca [128 x i32], align 4
%base = bitcast ptr %data to ptr
%ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 -512
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_frameindex_8() nounwind {
; RV32I-LABEL: test_prefetch_frameindex_8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -512
; RV32I-NEXT: addi sp, sp, 512
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_frameindex_8:
; RV64I: # %bb.0:
; RV64I-NEXT: addi sp, sp, -512
; RV64I-NEXT: addi sp, sp, 512
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_frameindex_8:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi sp, sp, -512
; RV32ZICBOP-NEXT: addi a0, sp, 2020
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: addi sp, sp, 512
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_frameindex_8:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi sp, sp, -512
; RV64ZICBOP-NEXT: addi a0, sp, 2020
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: addi sp, sp, 512
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_frameindex_8:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, -512
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, sp, 2020
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, 512
; RV64ZICBOPZIHINTNTL-NEXT: ret
%data = alloca [128 x i32], align 4
%base = bitcast ptr %data to ptr
%ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 505
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_frameindex_9() nounwind {
; RV32I-LABEL: test_prefetch_frameindex_9:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -512
; RV32I-NEXT: addi sp, sp, 512
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_frameindex_9:
; RV64I: # %bb.0:
; RV64I-NEXT: addi sp, sp, -512
; RV64I-NEXT: addi sp, sp, 512
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_frameindex_9:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: addi sp, sp, -512
; RV32ZICBOP-NEXT: mv a0, sp
; RV32ZICBOP-NEXT: addi a0, a0, -4
; RV32ZICBOP-NEXT: prefetch.r -2048(a0)
; RV32ZICBOP-NEXT: addi sp, sp, 512
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_frameindex_9:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: addi sp, sp, -512
; RV64ZICBOP-NEXT: mv a0, sp
; RV64ZICBOP-NEXT: addi a0, a0, -4
; RV64ZICBOP-NEXT: prefetch.r -2048(a0)
; RV64ZICBOP-NEXT: addi sp, sp, 512
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_frameindex_9:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, -512
; RV64ZICBOPZIHINTNTL-NEXT: mv a0, sp
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, -4
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r -2048(a0)
; RV64ZICBOPZIHINTNTL-NEXT: addi sp, sp, 512
; RV64ZICBOPZIHINTNTL-NEXT: ret
%data = alloca [128 x i32], align 4
%base = bitcast ptr %data to ptr
%ptr = getelementptr [128 x i32], ptr %base, i32 0, i32 -513
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_constant_address_0() nounwind {
; RV32I-LABEL: test_prefetch_constant_address_0:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_constant_address_0:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_constant_address_0:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, 1
; RV32ZICBOP-NEXT: prefetch.r 32(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_constant_address_0:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, 1
; RV64ZICBOP-NEXT: prefetch.r 32(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_constant_address_0:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, 1
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 32(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = inttoptr i64 4128 to ptr
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_constant_address_1() nounwind {
; RV32I-LABEL: test_prefetch_constant_address_1:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_constant_address_1:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_constant_address_1:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, 1
; RV32ZICBOP-NEXT: addi a0, a0, 31
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_constant_address_1:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, 1
; RV64ZICBOP-NEXT: addi a0, a0, 31
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_constant_address_1:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, 1
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, 31
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = inttoptr i64 4127 to ptr
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_constant_address_2() nounwind {
; RV32I-LABEL: test_prefetch_constant_address_2:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_constant_address_2:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_constant_address_2:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, 1048561
; RV32ZICBOP-NEXT: prefetch.r 32(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_constant_address_2:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, 1048561
; RV64ZICBOP-NEXT: prefetch.r 32(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_constant_address_2:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, 1048561
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 32(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = inttoptr i64 18446744073709490208 to ptr
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_constant_address_3() nounwind {
; RV32I-LABEL: test_prefetch_constant_address_3:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_constant_address_3:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_constant_address_3:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, 1048561
; RV32ZICBOP-NEXT: addi a0, a0, 31
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_constant_address_3:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, 1048561
; RV64ZICBOP-NEXT: addi a0, a0, 31
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_constant_address_3:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, 1048561
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, 31
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = inttoptr i64 18446744073709490207 to ptr
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
@g = external global [1024 x i32], align 4
define void @test_prefetch_global_0() nounwind {
; RV32I-LABEL: test_prefetch_global_0:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_global_0:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_global_0:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, %hi(g)
; RV32ZICBOP-NEXT: addi a0, a0, %lo(g)
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_global_0:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, %hi(g)
; RV64ZICBOP-NEXT: addi a0, a0, %lo(g)
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_global_0:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, %hi(g)
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, %lo(g)
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 0
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_global_1() nounwind {
; RV32I-LABEL: test_prefetch_global_1:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_global_1:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_global_1:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, %hi(g+16)
; RV32ZICBOP-NEXT: addi a0, a0, %lo(g+16)
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_global_1:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, %hi(g+16)
; RV64ZICBOP-NEXT: addi a0, a0, %lo(g+16)
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_global_1:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, %hi(g+16)
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, %lo(g+16)
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 4
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_global_2() nounwind {
; RV32I-LABEL: test_prefetch_global_2:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_global_2:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_global_2:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, %hi(g-16)
; RV32ZICBOP-NEXT: addi a0, a0, %lo(g-16)
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_global_2:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, %hi(g-16)
; RV64ZICBOP-NEXT: addi a0, a0, %lo(g-16)
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_global_2:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, %hi(g-16)
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, %lo(g-16)
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 -4
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_global_3() nounwind {
; RV32I-LABEL: test_prefetch_global_3:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_global_3:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_global_3:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, %hi(g)
; RV32ZICBOP-NEXT: addi a0, a0, %lo(g)
; RV32ZICBOP-NEXT: prefetch.r 32(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_global_3:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, %hi(g)
; RV64ZICBOP-NEXT: addi a0, a0, %lo(g)
; RV64ZICBOP-NEXT: prefetch.r 32(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_global_3:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, %hi(g)
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, %lo(g)
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 32(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 8
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_global_4() nounwind {
; RV32I-LABEL: test_prefetch_global_4:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_global_4:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_global_4:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, %hi(g)
; RV32ZICBOP-NEXT: addi a0, a0, %lo(g)
; RV32ZICBOP-NEXT: prefetch.r -32(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_global_4:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, %hi(g)
; RV64ZICBOP-NEXT: addi a0, a0, %lo(g)
; RV64ZICBOP-NEXT: prefetch.r -32(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_global_4:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, %hi(g)
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, %lo(g)
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r -32(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 -8
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_global_5() nounwind {
; RV32I-LABEL: test_prefetch_global_5:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_global_5:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_global_5:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, %hi(g)
; RV32ZICBOP-NEXT: addi a0, a0, %lo(g)
; RV32ZICBOP-NEXT: prefetch.r 2016(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_global_5:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, %hi(g)
; RV64ZICBOP-NEXT: addi a0, a0, %lo(g)
; RV64ZICBOP-NEXT: prefetch.r 2016(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_global_5:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, %hi(g)
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, %lo(g)
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 2016(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 504
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_global_6() nounwind {
; RV32I-LABEL: test_prefetch_global_6:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_global_6:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_global_6:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, %hi(g)
; RV32ZICBOP-NEXT: addi a0, a0, %lo(g)
; RV32ZICBOP-NEXT: prefetch.r -2048(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_global_6:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, %hi(g)
; RV64ZICBOP-NEXT: addi a0, a0, %lo(g)
; RV64ZICBOP-NEXT: prefetch.r -2048(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_global_6:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, %hi(g)
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, %lo(g)
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r -2048(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 -512
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_global_7() nounwind {
; RV32I-LABEL: test_prefetch_global_7:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_global_7:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_global_7:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, %hi(g+2020)
; RV32ZICBOP-NEXT: addi a0, a0, %lo(g+2020)
; RV32ZICBOP-NEXT: prefetch.r 0(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_global_7:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, %hi(g+2020)
; RV64ZICBOP-NEXT: addi a0, a0, %lo(g+2020)
; RV64ZICBOP-NEXT: prefetch.r 0(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_global_7:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, %hi(g+2020)
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, %lo(g+2020)
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r 0(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 505
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}
define void @test_prefetch_global_8() nounwind {
; RV32I-LABEL: test_prefetch_global_8:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
;
; RV64I-LABEL: test_prefetch_global_8:
; RV64I: # %bb.0:
; RV64I-NEXT: ret
;
; RV32ZICBOP-LABEL: test_prefetch_global_8:
; RV32ZICBOP: # %bb.0:
; RV32ZICBOP-NEXT: lui a0, %hi(g-4)
; RV32ZICBOP-NEXT: addi a0, a0, %lo(g-4)
; RV32ZICBOP-NEXT: prefetch.r -2048(a0)
; RV32ZICBOP-NEXT: ret
;
; RV64ZICBOP-LABEL: test_prefetch_global_8:
; RV64ZICBOP: # %bb.0:
; RV64ZICBOP-NEXT: lui a0, %hi(g-4)
; RV64ZICBOP-NEXT: addi a0, a0, %lo(g-4)
; RV64ZICBOP-NEXT: prefetch.r -2048(a0)
; RV64ZICBOP-NEXT: ret
;
; RV64ZICBOPZIHINTNTL-LABEL: test_prefetch_global_8:
; RV64ZICBOPZIHINTNTL: # %bb.0:
; RV64ZICBOPZIHINTNTL-NEXT: lui a0, %hi(g-4)
; RV64ZICBOPZIHINTNTL-NEXT: addi a0, a0, %lo(g-4)
; RV64ZICBOPZIHINTNTL-NEXT: ntl.all
; RV64ZICBOPZIHINTNTL-NEXT: prefetch.r -2048(a0)
; RV64ZICBOPZIHINTNTL-NEXT: ret
%ptr = getelementptr [1024 x i32], ptr @g, i32 0, i32 -513
call void @llvm.prefetch(ptr %ptr, i32 0, i32 0, i32 1)
ret void
}