Skip to content

Commit b5e87c9

Browse files
committed
[AArch64][GlobalISel] Add selection support for <8 x s16> G_INSERT_VECTOR_ELT with GPR scalar.
Fixes the neon intrinsics test in the test suite.
1 parent 62c3727 commit b5e87c9

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3799,7 +3799,10 @@ static std::pair<unsigned, unsigned>
37993799
getInsertVecEltOpInfo(const RegisterBank &RB, unsigned EltSize) {
38003800
unsigned Opc, SubregIdx;
38013801
if (RB.getID() == AArch64::GPRRegBankID) {
3802-
if (EltSize == 32) {
3802+
if (EltSize == 16) {
3803+
Opc = AArch64::INSvi16gpr;
3804+
SubregIdx = AArch64::ssub;
3805+
} else if (EltSize == 32) {
38033806
Opc = AArch64::INSvi32gpr;
38043807
SubregIdx = AArch64::ssub;
38053808
} else if (EltSize == 64) {

llvm/test/CodeGen/AArch64/GlobalISel/select-insert-vector-elt.mir

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
22
# RUN: llc -verify-machineinstrs -mtriple aarch64-unknown-unknown -run-pass=instruction-select %s -o - | FileCheck %s
33
---
4+
name: v8s16_gpr
5+
alignment: 4
6+
legalized: true
7+
regBankSelected: true
8+
tracksRegLiveness: true
9+
body: |
10+
bb.0:
11+
liveins: $q1, $w0
12+
13+
; CHECK-LABEL: name: v8s16_gpr
14+
; CHECK: liveins: $q1, $w0
15+
; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
16+
; CHECK: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1
17+
; CHECK: [[INSvi16gpr:%[0-9]+]]:fpr128 = INSvi16gpr [[COPY1]], 1, [[COPY]]
18+
; CHECK: $q0 = COPY [[INSvi16gpr]]
19+
; CHECK: RET_ReallyLR implicit $q0
20+
%0:gpr(s32) = COPY $w0
21+
%trunc:gpr(s16) = G_TRUNC %0
22+
%1:fpr(<8 x s16>) = COPY $q1
23+
%3:gpr(s32) = G_CONSTANT i32 1
24+
%2:fpr(<8 x s16>) = G_INSERT_VECTOR_ELT %1, %trunc:gpr(s16), %3:gpr(s32)
25+
$q0 = COPY %2(<8 x s16>)
26+
RET_ReallyLR implicit $q0
27+
28+
...
29+
---
430
name: v8s16_fpr
531
alignment: 4
632
legalized: true

0 commit comments

Comments
 (0)