llvm-project/llvm/test/CodeGen/AArch64/aarch64-load-ext.ll

113 lines
3.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s --check-prefix CHECK-LE
; RUN: llc -mtriple=aarch64_be-unknown-linux-gnu < %s | FileCheck %s --check-prefix CHECK-BE
define <2 x i16> @test0(i16* %i16_ptr, i64 %inc) {
; CHECK-LE-LABEL: test0:
; CHECK-LE: // %bb.0:
; CHECK-LE-NEXT: ld1 { v0.h }[0], [x0]
; CHECK-LE-NEXT: // kill: def $d0 killed $d0 killed $q0
; CHECK-LE-NEXT: ret
;
; CHECK-BE-LABEL: test0:
; CHECK-BE: // %bb.0:
; CHECK-BE-NEXT: ld1 { v0.h }[0], [x0]
; CHECK-BE-NEXT: rev64 v0.2s, v0.2s
; CHECK-BE-NEXT: ret
%i_0 = load i16, i16* %i16_ptr
%v0 = insertelement <2 x i16> undef, i16 %i_0, i32 0
ret <2 x i16> %v0
}
define <2 x i16> @test1(<2 x i16>* %v2i16_ptr) {
; CHECK-LE-LABEL: test1:
; CHECK-LE: // %bb.0:
; CHECK-LE-NEXT: ld1 { v0.h }[0], [x0]
; CHECK-LE-NEXT: add x8, x0, #2 // =2
; CHECK-LE-NEXT: ld1 { v0.h }[2], [x8]
; CHECK-LE-NEXT: // kill: def $d0 killed $d0 killed $q0
; CHECK-LE-NEXT: ret
;
; CHECK-BE-LABEL: test1:
; CHECK-BE: // %bb.0:
; CHECK-BE-NEXT: ld1 { v0.h }[0], [x0]
; CHECK-BE-NEXT: add x8, x0, #2 // =2
; CHECK-BE-NEXT: ld1 { v0.h }[2], [x8]
; CHECK-BE-NEXT: rev64 v0.2s, v0.2s
; CHECK-BE-NEXT: ret
%v2i16 = load <2 x i16>, <2 x i16>* %v2i16_ptr
ret <2 x i16> %v2i16
}
define <2 x i16> @test2(i16* %i16_ptr, i64 %inc) {
; CHECK-LE-LABEL: test2:
; CHECK-LE: // %bb.0:
; CHECK-LE-NEXT: ld1 { v0.h }[0], [x0]
; CHECK-LE-NEXT: add x8, x0, x1, lsl #1
; CHECK-LE-NEXT: ld1 { v0.h }[2], [x8]
; CHECK-LE-NEXT: // kill: def $d0 killed $d0 killed $q0
; CHECK-LE-NEXT: ret
;
; CHECK-BE-LABEL: test2:
; CHECK-BE: // %bb.0:
; CHECK-BE-NEXT: ld1 { v0.h }[0], [x0]
; CHECK-BE-NEXT: add x8, x0, x1, lsl #1
; CHECK-BE-NEXT: ld1 { v0.h }[2], [x8]
; CHECK-BE-NEXT: rev64 v0.2s, v0.2s
; CHECK-BE-NEXT: ret
%i_0 = load i16, i16* %i16_ptr
%i16_ptr_inc = getelementptr i16, i16* %i16_ptr, i64 %inc
%i_1 = load i16, i16* %i16_ptr_inc
%v0 = insertelement <2 x i16> undef, i16 %i_0, i32 0
%v1 = insertelement <2 x i16> %v0, i16 %i_1, i32 1
ret <2 x i16> %v1
}
define <2 x i8> @test3(<2 x i8>* %v2i8_ptr) {
; CHECK-LE-LABEL: test3:
; CHECK-LE: // %bb.0:
; CHECK-LE-NEXT: ld1 { v0.b }[0], [x0]
; CHECK-LE-NEXT: add x8, x0, #1 // =1
; CHECK-LE-NEXT: ld1 { v0.b }[4], [x8]
; CHECK-LE-NEXT: // kill: def $d0 killed $d0 killed $q0
; CHECK-LE-NEXT: ret
;
; CHECK-BE-LABEL: test3:
; CHECK-BE: // %bb.0:
; CHECK-BE-NEXT: ld1 { v0.b }[0], [x0]
; CHECK-BE-NEXT: add x8, x0, #1 // =1
; CHECK-BE-NEXT: ld1 { v0.b }[4], [x8]
; CHECK-BE-NEXT: rev64 v0.2s, v0.2s
; CHECK-BE-NEXT: ret
%v2i8 = load <2 x i8>, <2 x i8>* %v2i8_ptr
ret <2 x i8> %v2i8
}
define <4 x i8> @test4(<4 x i8>* %v4i8_ptr) {
; CHECK-LE-LABEL: test4:
; CHECK-LE: // %bb.0:
; CHECK-LE-NEXT: ld1 { v0.b }[0], [x0]
; CHECK-LE-NEXT: add x8, x0, #1 // =1
; CHECK-LE-NEXT: ld1 { v0.b }[2], [x8]
; CHECK-LE-NEXT: add x8, x0, #2 // =2
; CHECK-LE-NEXT: ld1 { v0.b }[4], [x8]
; CHECK-LE-NEXT: add x8, x0, #3 // =3
; CHECK-LE-NEXT: ld1 { v0.b }[6], [x8]
; CHECK-LE-NEXT: // kill: def $d0 killed $d0 killed $q0
; CHECK-LE-NEXT: ret
;
; CHECK-BE-LABEL: test4:
; CHECK-BE: // %bb.0:
; CHECK-BE-NEXT: ld1 { v0.b }[0], [x0]
; CHECK-BE-NEXT: add x8, x0, #1 // =1
; CHECK-BE-NEXT: ld1 { v0.b }[2], [x8]
; CHECK-BE-NEXT: add x8, x0, #2 // =2
; CHECK-BE-NEXT: ld1 { v0.b }[4], [x8]
; CHECK-BE-NEXT: add x8, x0, #3 // =3
; CHECK-BE-NEXT: ld1 { v0.b }[6], [x8]
; CHECK-BE-NEXT: rev64 v0.4h, v0.4h
; CHECK-BE-NEXT: ret
%v4i8 = load <4 x i8>, <4 x i8>* %v4i8_ptr
ret <4 x i8> %v4i8
}