1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/CodeGen/AArch64/sve-ld-post-inc.ll
Peter Waller f69dc8533f [CodeGen][AArch64][SVE] Use ld1r[bhsd] for vector splat from memory
This avoids the use of the vector unit for copying from scalar to
vector. There is an extra ptrue instruction, but a predicate register
with the ptrue pattern populated is likely to be free in the context of
real code.

Tests were generated from a template to cover the axes mentioned at the
top of the test file.

Co-authored-by: Francesco Petrogalli <francesco.petrogalli@arm.com>

Differential Revision: https://reviews.llvm.org/D103170
2021-07-06 12:03:54 +00:00

39 lines
1.4 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
; These tests are here to ensure we don't get a selection error caused
; by performPostLD1Combine, which should bail out if the return
; type is a scalable vector
define <vscale x 4 x i32> @test_post_ld1_insert(i32* %a, i32** %ptr, i64 %inc) {
; CHECK-LABEL: test_post_ld1_insert:
; CHECK: // %bb.0:
; CHECK-NEXT: ldr w8, [x0]
; CHECK-NEXT: add x9, x0, x2, lsl #2
; CHECK-NEXT: str x9, [x1]
; CHECK-NEXT: fmov s0, w8
; CHECK-NEXT: ret
%load = load i32, i32* %a
%ins = insertelement <vscale x 4 x i32> undef, i32 %load, i32 0
%gep = getelementptr i32, i32* %a, i64 %inc
store i32* %gep, i32** %ptr
ret <vscale x 4 x i32> %ins
}
define <vscale x 2 x double> @test_post_ld1_dup(double* %a, double** %ptr, i64 %inc) {
; CHECK-LABEL: test_post_ld1_dup:
; CHECK: // %bb.0:
; CHECK-NEXT: ptrue p0.d
; CHECK-NEXT: ld1rd { z0.d }, p0/z, [x0]
; CHECK-NEXT: add x8, x0, x2, lsl #3
; CHECK-NEXT: str x8, [x1]
; CHECK-NEXT: ret
%load = load double, double* %a
%dup = call <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double %load)
%gep = getelementptr double, double* %a, i64 %inc
store double* %gep, double** %ptr
ret <vscale x 2 x double> %dup
}
declare <vscale x 2 x double> @llvm.aarch64.sve.dup.x.nxv2f64(double)