2021-03-18 05:46:32 +08:00
|
|
|
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
|
[AArch64][SVE] Add intrinsics for gather loads with 64-bit offsets
This patch adds the following intrinsics for gather loads with 64-bit offsets:
* @llvm.aarch64.sve.ld1.gather (unscaled offset)
* @llvm.aarch64.sve.ld1.gather.index (scaled offset)
These intrinsics map 1-1 to the following AArch64 instructions respectively (examples for half-words):
* ld1h { z0.d }, p0/z, [x0, z0.d]
* ld1h { z0.d }, p0/z, [x0, z0.d, lsl #1]
Committing on behalf of Andrzej Warzynski (andwar)
Reviewers: sdesmalen, huntergr, rovka, mgudim, dancgr, rengolin, efriedma
Reviewed By: efriedma
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70542
2019-12-03 19:25:07 +08:00
|
|
|
|
|
|
|
;
|
|
|
|
; LD1B, LD1W, LD1H, LD1D: base + 64-bit unscaled offset
|
|
|
|
; e.g. ld1h { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
;
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1b_d(<vscale x 2 x i1> %pg, i8* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1b_d:
|
|
|
|
; CHECK: ld1b { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%load = call <vscale x 2 x i8> @llvm.aarch64.sve.ld1.gather.nxv2i8(<vscale x 2 x i1> %pg,
|
|
|
|
i8* %base,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%res = zext <vscale x 2 x i8> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1h_d(<vscale x 2 x i1> %pg, i16* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1h_d:
|
|
|
|
; CHECK: ld1h { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.nxv2i16(<vscale x 2 x i1> %pg,
|
|
|
|
i16* %base,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%res = zext <vscale x 2 x i16> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1w_d(<vscale x 2 x i1> %pg, i32* %base, <vscale x 2 x i64> %offsets) {
|
|
|
|
; CHECK-LABEL: gld1w_d:
|
|
|
|
; CHECK: ld1w { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.nxv2i32(<vscale x 2 x i1> %pg,
|
|
|
|
i32* %base,
|
|
|
|
<vscale x 2 x i64> %offsets)
|
|
|
|
%res = zext <vscale x 2 x i32> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1d_d(<vscale x 2 x i1> %pg, i64* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1d_d:
|
|
|
|
; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%load = call <vscale x 2 x i64> @llvm.aarch64.sve.ld1.gather.nxv2i64(<vscale x 2 x i1> %pg,
|
|
|
|
i64* %base,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
ret <vscale x 2 x i64> %load
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x double> @gld1d_d_double(<vscale x 2 x i1> %pg, double* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1d_d_double:
|
|
|
|
; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%load = call <vscale x 2 x double> @llvm.aarch64.sve.ld1.gather.nxv2f64(<vscale x 2 x i1> %pg,
|
|
|
|
double* %base,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
ret <vscale x 2 x double> %load
|
|
|
|
}
|
|
|
|
|
[AArch64][SVE] Add DAG combine rules for gather loads and sext/zext
Summary:
These changes allow us to support sign-extending gather loads with the
exisiting intrinsics (i.e. @llvm.aarch64.sve.ld1.gather.*).
Reviewers: sdesmalen, huntergr, kmclaughlin, efriedma, rengolin, rovka, dancgr, mgudim
Reviewed By: sdesmalen
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential revision: https://reviews.llvm.org/D70812
2019-11-25 21:54:47 +08:00
|
|
|
;
|
|
|
|
; LD1SB, LD1SW, LD1SH: base + 64-bit unscaled offset
|
|
|
|
; e.g. ld1sh { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
;
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1sb_d(<vscale x 2 x i1> %pg, i8* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1sb_d:
|
|
|
|
; CHECK: ld1sb { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%load = call <vscale x 2 x i8> @llvm.aarch64.sve.ld1.gather.nxv2i8(<vscale x 2 x i1> %pg,
|
|
|
|
i8* %base,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%res = sext <vscale x 2 x i8> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1sh_d(<vscale x 2 x i1> %pg, i16* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1sh_d:
|
|
|
|
; CHECK: ld1sh { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.nxv2i16(<vscale x 2 x i1> %pg,
|
|
|
|
i16* %base,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%res = sext <vscale x 2 x i16> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1sw_d(<vscale x 2 x i1> %pg, i32* %base, <vscale x 2 x i64> %offsets) {
|
|
|
|
; CHECK-LABEL: gld1sw_d:
|
|
|
|
; CHECK: ld1sw { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.nxv2i32(<vscale x 2 x i1> %pg,
|
|
|
|
i32* %base,
|
|
|
|
<vscale x 2 x i64> %offsets)
|
|
|
|
%res = sext <vscale x 2 x i32> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
[AArch64][SVE] Fold vector ZExt/SExt into gather loads where possible
This commit folds sxtw'd or uxtw'd offsets into gather loads where
possible with a DAGCombine optimization.
As an example, the following code:
1 #include <arm_sve.h>
2
3 svuint64_t func(svbool_t pred, const int32_t *base, svint64_t offsets) {
4 return svld1sw_gather_s64offset_u64(
5 pred, base, svextw_s64_x(pred, offsets)
6 );
7 }
would previously lower to the following assembly:
sxtw z0.d, p0/m, z0.d
ld1sw { z0.d }, p0/z, [x0, z0.d]
ret
but now lowers to:
ld1sw { z0.d }, p0/z, [x0, z0.d, sxtw]
ret
Differential Revision: https://reviews.llvm.org/D97858
2021-03-04 17:06:49 +08:00
|
|
|
;
|
|
|
|
; LD1B, LD1W, LD1H, LD1D: base + 64-bit sxtw'd unscaled offset
|
|
|
|
; e.g. ld1h { z0.d }, p0/z, [x0, z0.d, sxtw]
|
|
|
|
;
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1b_d_sxtw(<vscale x 2 x i1> %pg, i8* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1b_d_sxtw:
|
|
|
|
; CHECK: ld1b { z0.d }, p0/z, [x0, z0.d, sxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%sxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x i8> @llvm.aarch64.sve.ld1.gather.nxv2i8(<vscale x 2 x i1> %pg,
|
|
|
|
i8* %base,
|
|
|
|
<vscale x 2 x i64> %sxtw)
|
|
|
|
%res = zext <vscale x 2 x i8> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1h_d_sxtw(<vscale x 2 x i1> %pg, i16* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1h_d_sxtw:
|
|
|
|
; CHECK: ld1h { z0.d }, p0/z, [x0, z0.d, sxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%sxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.nxv2i16(<vscale x 2 x i1> %pg,
|
|
|
|
i16* %base,
|
|
|
|
<vscale x 2 x i64> %sxtw)
|
|
|
|
%res = zext <vscale x 2 x i16> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1w_d_sxtw(<vscale x 2 x i1> %pg, i32* %base, <vscale x 2 x i64> %offsets) {
|
|
|
|
; CHECK-LABEL: gld1w_d_sxtw:
|
|
|
|
; CHECK: ld1w { z0.d }, p0/z, [x0, z0.d, sxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%sxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %offsets)
|
|
|
|
%load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.nxv2i32(<vscale x 2 x i1> %pg,
|
|
|
|
i32* %base,
|
|
|
|
<vscale x 2 x i64> %sxtw)
|
|
|
|
%res = zext <vscale x 2 x i32> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1d_d_sxtw(<vscale x 2 x i1> %pg, i64* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1d_d_sxtw:
|
|
|
|
; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d, sxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%sxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x i64> @llvm.aarch64.sve.ld1.gather.nxv2i64(<vscale x 2 x i1> %pg,
|
|
|
|
i64* %base,
|
|
|
|
<vscale x 2 x i64> %sxtw)
|
|
|
|
ret <vscale x 2 x i64> %load
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x double> @gld1d_d_double_sxtw(<vscale x 2 x i1> %pg, double* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1d_d_double_sxtw:
|
|
|
|
; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d, sxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%sxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x double> @llvm.aarch64.sve.ld1.gather.nxv2f64(<vscale x 2 x i1> %pg,
|
|
|
|
double* %base,
|
|
|
|
<vscale x 2 x i64> %sxtw)
|
|
|
|
ret <vscale x 2 x double> %load
|
|
|
|
}
|
|
|
|
|
|
|
|
;
|
|
|
|
; LD1SB, LD1SW, LD1SH: base + 64-bit sxtw'd unscaled offset
|
|
|
|
; e.g. ld1sh { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
;
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1sb_d_sxtw(<vscale x 2 x i1> %pg, i8* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1sb_d_sxtw:
|
|
|
|
; CHECK: ld1sb { z0.d }, p0/z, [x0, z0.d, sxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%sxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x i8> @llvm.aarch64.sve.ld1.gather.nxv2i8(<vscale x 2 x i1> %pg,
|
|
|
|
i8* %base,
|
|
|
|
<vscale x 2 x i64> %sxtw)
|
|
|
|
%res = sext <vscale x 2 x i8> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1sh_d_sxtw(<vscale x 2 x i1> %pg, i16* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1sh_d_sxtw:
|
|
|
|
; CHECK: ld1sh { z0.d }, p0/z, [x0, z0.d, sxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%sxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.nxv2i16(<vscale x 2 x i1> %pg,
|
|
|
|
i16* %base,
|
|
|
|
<vscale x 2 x i64> %sxtw)
|
|
|
|
%res = sext <vscale x 2 x i16> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1sw_d_sxtw(<vscale x 2 x i1> %pg, i32* %base, <vscale x 2 x i64> %offsets) {
|
|
|
|
; CHECK-LABEL: gld1sw_d_sxtw:
|
|
|
|
; CHECK: ld1sw { z0.d }, p0/z, [x0, z0.d, sxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%sxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.sxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %offsets)
|
|
|
|
%load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.nxv2i32(<vscale x 2 x i1> %pg,
|
|
|
|
i32* %base,
|
|
|
|
<vscale x 2 x i64> %sxtw)
|
|
|
|
%res = sext <vscale x 2 x i32> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
;
|
|
|
|
; LD1B, LD1W, LD1H, LD1D: base + 64-bit uxtw'd unscaled offset
|
|
|
|
; e.g. ld1h { z0.d }, p0/z, [x0, z0.d, uxtw]
|
|
|
|
;
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1b_d_uxtw(<vscale x 2 x i1> %pg, i8* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1b_d_uxtw:
|
|
|
|
; CHECK: ld1b { z0.d }, p0/z, [x0, z0.d, uxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%uxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x i8> @llvm.aarch64.sve.ld1.gather.nxv2i8(<vscale x 2 x i1> %pg,
|
|
|
|
i8* %base,
|
|
|
|
<vscale x 2 x i64> %uxtw)
|
|
|
|
%res = zext <vscale x 2 x i8> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1h_d_uxtw(<vscale x 2 x i1> %pg, i16* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1h_d_uxtw:
|
|
|
|
; CHECK: ld1h { z0.d }, p0/z, [x0, z0.d, uxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%uxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.nxv2i16(<vscale x 2 x i1> %pg,
|
|
|
|
i16* %base,
|
|
|
|
<vscale x 2 x i64> %uxtw)
|
|
|
|
%res = zext <vscale x 2 x i16> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1w_d_uxtw(<vscale x 2 x i1> %pg, i32* %base, <vscale x 2 x i64> %offsets) {
|
|
|
|
; CHECK-LABEL: gld1w_d_uxtw:
|
|
|
|
; CHECK: ld1w { z0.d }, p0/z, [x0, z0.d, uxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%uxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %offsets)
|
|
|
|
%load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.nxv2i32(<vscale x 2 x i1> %pg,
|
|
|
|
i32* %base,
|
|
|
|
<vscale x 2 x i64> %uxtw)
|
|
|
|
%res = zext <vscale x 2 x i32> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1d_d_uxtw(<vscale x 2 x i1> %pg, i64* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1d_d_uxtw:
|
|
|
|
; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d, uxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%uxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x i64> @llvm.aarch64.sve.ld1.gather.nxv2i64(<vscale x 2 x i1> %pg,
|
|
|
|
i64* %base,
|
|
|
|
<vscale x 2 x i64> %uxtw)
|
|
|
|
ret <vscale x 2 x i64> %load
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x double> @gld1d_d_double_uxtw(<vscale x 2 x i1> %pg, double* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1d_d_double_uxtw:
|
|
|
|
; CHECK: ld1d { z0.d }, p0/z, [x0, z0.d, uxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%uxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x double> @llvm.aarch64.sve.ld1.gather.nxv2f64(<vscale x 2 x i1> %pg,
|
|
|
|
double* %base,
|
|
|
|
<vscale x 2 x i64> %uxtw)
|
|
|
|
ret <vscale x 2 x double> %load
|
|
|
|
}
|
|
|
|
|
|
|
|
;
|
|
|
|
; LD1SB, LD1SW, LD1SH: base + 64-bit uxtw'd unscaled offset
|
|
|
|
; e.g. ld1sh { z0.d }, p0/z, [x0, z0.d]
|
|
|
|
;
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1sb_d_uxtw(<vscale x 2 x i1> %pg, i8* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1sb_d_uxtw:
|
|
|
|
; CHECK: ld1sb { z0.d }, p0/z, [x0, z0.d, uxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%uxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x i8> @llvm.aarch64.sve.ld1.gather.nxv2i8(<vscale x 2 x i1> %pg,
|
|
|
|
i8* %base,
|
|
|
|
<vscale x 2 x i64> %uxtw)
|
|
|
|
%res = sext <vscale x 2 x i8> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1sh_d_uxtw(<vscale x 2 x i1> %pg, i16* %base, <vscale x 2 x i64> %b) {
|
|
|
|
; CHECK-LABEL: gld1sh_d_uxtw:
|
|
|
|
; CHECK: ld1sh { z0.d }, p0/z, [x0, z0.d, uxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%uxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %b)
|
|
|
|
%load = call <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.nxv2i16(<vscale x 2 x i1> %pg,
|
|
|
|
i16* %base,
|
|
|
|
<vscale x 2 x i64> %uxtw)
|
|
|
|
%res = sext <vscale x 2 x i16> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <vscale x 2 x i64> @gld1sw_d_uxtw(<vscale x 2 x i1> %pg, i32* %base, <vscale x 2 x i64> %offsets) {
|
|
|
|
; CHECK-LABEL: gld1sw_d_uxtw:
|
|
|
|
; CHECK: ld1sw { z0.d }, p0/z, [x0, z0.d, uxtw]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
%uxtw = call <vscale x 2 x i64> @llvm.aarch64.sve.uxtw.nxv2i64(<vscale x 2 x i64> undef,
|
|
|
|
<vscale x 2 x i1> %pg,
|
|
|
|
<vscale x 2 x i64> %offsets)
|
|
|
|
%load = call <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.nxv2i32(<vscale x 2 x i1> %pg,
|
|
|
|
i32* %base,
|
|
|
|
<vscale x 2 x i64> %uxtw)
|
|
|
|
%res = sext <vscale x 2 x i32> %load to <vscale x 2 x i64>
|
|
|
|
ret <vscale x 2 x i64> %res
|
|
|
|
}
|
|
|
|
|
[AArch64][SVE] Add intrinsics for gather loads with 64-bit offsets
This patch adds the following intrinsics for gather loads with 64-bit offsets:
* @llvm.aarch64.sve.ld1.gather (unscaled offset)
* @llvm.aarch64.sve.ld1.gather.index (scaled offset)
These intrinsics map 1-1 to the following AArch64 instructions respectively (examples for half-words):
* ld1h { z0.d }, p0/z, [x0, z0.d]
* ld1h { z0.d }, p0/z, [x0, z0.d, lsl #1]
Committing on behalf of Andrzej Warzynski (andwar)
Reviewers: sdesmalen, huntergr, rovka, mgudim, dancgr, rengolin, efriedma
Reviewed By: efriedma
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70542
2019-12-03 19:25:07 +08:00
|
|
|
declare <vscale x 2 x i8> @llvm.aarch64.sve.ld1.gather.nxv2i8(<vscale x 2 x i1>, i8*, <vscale x 2 x i64>)
|
|
|
|
declare <vscale x 2 x i16> @llvm.aarch64.sve.ld1.gather.nxv2i16(<vscale x 2 x i1>, i16*, <vscale x 2 x i64>)
|
|
|
|
declare <vscale x 2 x i32> @llvm.aarch64.sve.ld1.gather.nxv2i32(<vscale x 2 x i1>, i32*, <vscale x 2 x i64>)
|
|
|
|
declare <vscale x 2 x i64> @llvm.aarch64.sve.ld1.gather.nxv2i64(<vscale x 2 x i1>, i64*, <vscale x 2 x i64>)
|
|
|
|
declare <vscale x 2 x double> @llvm.aarch64.sve.ld1.gather.nxv2f64(<vscale x 2 x i1>, double*, <vscale x 2 x i64>)
|
[AArch64][SVE] Fold vector ZExt/SExt into gather loads where possible
This commit folds sxtw'd or uxtw'd offsets into gather loads where
possible with a DAGCombine optimization.
As an example, the following code:
1 #include <arm_sve.h>
2
3 svuint64_t func(svbool_t pred, const int32_t *base, svint64_t offsets) {
4 return svld1sw_gather_s64offset_u64(
5 pred, base, svextw_s64_x(pred, offsets)
6 );
7 }
would previously lower to the following assembly:
sxtw z0.d, p0/m, z0.d
ld1sw { z0.d }, p0/z, [x0, z0.d]
ret
but now lowers to:
ld1sw { z0.d }, p0/z, [x0, z0.d, sxtw]
ret
Differential Revision: https://reviews.llvm.org/D97858
2021-03-04 17:06:49 +08:00
|
|
|
|
|
|
|
declare <vscale x 2 x i64> @llvm.aarch64.sve.sxtw.nxv2i64(<vscale x 2 x i64>, <vscale x 2 x i1>, <vscale x 2 x i64>)
|
|
|
|
declare <vscale x 2 x i64> @llvm.aarch64.sve.uxtw.nxv2i64(<vscale x 2 x i64>, <vscale x 2 x i1>, <vscale x 2 x i64>)
|