Skip to content

Commit 05041c1

Browse files
committed
Move patterns to AArch64InstrInfo.td; add OnlyGISel; rebase
1 parent d1b1fbf commit 05041c1

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

llvm/lib/Target/AArch64/AArch64InstrGISel.td

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,3 @@ def : Pat<(v2i64 (AArch64dup (i64 (load GPR64sp:$Rn)))),
516516
(LD1Rv2d GPR64sp:$Rn)>;
517517
def : Pat<(v1i64 (AArch64dup (i64 (load GPR64sp:$Rn)))),
518518
(LD1Rv1d GPR64sp:$Rn)>;
519-
520-
defm : LoadInsertPatterns<load, v16i8, v8i8, nxv16i8, i8,
521-
LDRBui, LDURBi, LDRBroW, LDRBroX,
522-
ro8, am_indexed8, am_unscaled8, uimm12s1, bsub>;
523-
def : Ld1Lane64Pat<load, VectorIndexB, v8i8, i8, LD1i8>;
524-
def : Ld1Lane128Pat<load, VectorIndexB, v16i8, i8, LD1i8>;
525-
defm : Neon_INS_elt_pattern<v16i8, v8i8, nxv16i8, i8, VectorIndexB, INSvi8lane>;

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,12 +1114,15 @@ let RecomputePerFunction = 1 in {
11141114

11151115
def SLSBLRMitigation : Predicate<[{ MF->getSubtarget<AArch64Subtarget>().hardenSlsBlr() }]>;
11161116
def NoSLSBLRMitigation : Predicate<[{ !MF->getSubtarget<AArch64Subtarget>().hardenSlsBlr() }]>;
1117+
1118+
defvar GISelLegalizedCheck = "(!MF->getProperties().hasProperty(MachineFunctionProperties::Property::FailedISel) && MF->getProperties().hasProperty(MachineFunctionProperties::Property::Legalized))";
1119+
def OnlyGISel : Predicate<GISelLegalizedCheck>;
11171120
// Toggles patterns which aren't beneficial in GlobalISel when we aren't
11181121
// optimizing. This allows us to selectively use patterns without impacting
11191122
// SelectionDAG's behaviour.
11201123
// FIXME: One day there will probably be a nicer way to check for this, but
11211124
// today is not that day.
1122-
def OptimizedGISelOrOtherSelector : Predicate<"!MF->getFunction().hasOptNone() || MF->getProperties().hasProperty(MachineFunctionProperties::Property::FailedISel) || !MF->getProperties().hasProperty(MachineFunctionProperties::Property::Legalized)">;
1125+
def OptimizedGISelOrOtherSelector : Predicate<!strconcat("!MF->getFunction().hasOptNone() || !", GISelLegalizedCheck)>;
11231126
}
11241127

11251128
include "AArch64InstrFormats.td"
@@ -4036,6 +4039,11 @@ multiclass LoadInsertPatterns<SDPatternOperator LoadOp, ValueType VT, ValueType
40364039
ROXLoadInst, ro, Addr, UnscaledAddr, AddrImm, SubReg>;
40374040
}
40384041

4042+
let Predicates = [OnlyGISel] in {
4043+
defm : LoadInsertPatterns<load, v16i8, v8i8, nxv16i8, i8,
4044+
LDRBui, LDURBi, LDRBroW, LDRBroX,
4045+
ro8, am_indexed8, am_unscaled8, uimm12s1, bsub>;
4046+
}
40394047
defm : LoadInsertPatterns<extloadi8, v16i8, v8i8, nxv16i8, i32,
40404048
LDRBui, LDURBi, LDRBroW, LDRBroX,
40414049
ro8, am_indexed8, am_unscaled8, uimm12s1, bsub>;
@@ -7330,6 +7338,9 @@ defm : Neon_INS_elt_pattern<v8bf16, v4bf16, nxv8bf16, bf16, VectorIndexH, INSvi1
73307338
defm : Neon_INS_elt_pattern<v4f32, v2f32, nxv4f32, f32, VectorIndexS, INSvi32lane, DUPi32, ssub>;
73317339
defm : Neon_INS_elt_pattern<v2f64, v1f64, nxv2f64, f64, VectorIndexD, INSvi64lane, DUPi64, dsub>;
73327340

7341+
let Predicates = [OnlyGISel] in {
7342+
defm : Neon_INS_elt_pattern<v16i8, v8i8, nxv16i8, i8, VectorIndexB, INSvi8lane, DUPi8, bsub>;
7343+
}
73337344
defm : Neon_INS_elt_pattern<v16i8, v8i8, nxv16i8, i32, VectorIndexB, INSvi8lane, DUPi8, bsub>;
73347345
defm : Neon_INS_elt_pattern<v8i16, v4i16, nxv8i16, i32, VectorIndexH, INSvi16lane, DUPi16, hsub>;
73357346
defm : Neon_INS_elt_pattern<v4i32, v2i32, nxv4i32, i32, VectorIndexS, INSvi32lane, DUPi32, ssub>;
@@ -8752,6 +8763,9 @@ class Ld1Lane128Pat<SDPatternOperator scalar_load, Operand VecIndex,
87528763
(STy (scalar_load GPR64sp:$Rn)), (i64 VecIndex:$idx)),
87538764
(LD1 VecListOne128:$Rd, VecIndex:$idx, GPR64sp:$Rn)>;
87548765

8766+
let Predicates = [OnlyGISel] in {
8767+
def : Ld1Lane128Pat<load, VectorIndexB, v16i8, i8, LD1i8>;
8768+
}
87558769
def : Ld1Lane128Pat<extloadi8, VectorIndexB, v16i8, i32, LD1i8>;
87568770
def : Ld1Lane128Pat<extloadi16, VectorIndexH, v8i16, i32, LD1i16>;
87578771
def : Ld1Lane128Pat<load, VectorIndexS, v4i32, i32, LD1i32>;
@@ -8825,6 +8839,9 @@ class Ld1Lane64Pat<SDPatternOperator scalar_load, Operand VecIndex,
88258839
VecIndex:$idx, GPR64sp:$Rn),
88268840
dsub)>;
88278841

8842+
let Predicates = [OnlyGISel] in {
8843+
def : Ld1Lane64Pat<load, VectorIndexB, v8i8, i8, LD1i8>;
8844+
}
88288845
def : Ld1Lane64Pat<extloadi8, VectorIndexB, v8i8, i32, LD1i8>;
88298846
def : Ld1Lane64Pat<extloadi16, VectorIndexH, v4i16, i32, LD1i16>;
88308847
def : Ld1Lane64Pat<load, VectorIndexS, v2i32, i32, LD1i32>;

llvm/test/CodeGen/AArch64/arm64-neon-copy.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ define <16 x i8> @test_concat_v16i8_v16i8_v8i8(<16 x i8> %x, <8 x i8> %y) #0 {
17851785
;
17861786
; CHECK-GI-LABEL: test_concat_v16i8_v16i8_v8i8:
17871787
; CHECK-GI: // %bb.0: // %entry
1788-
; CHECK-GI-NEXT: mov v2.b[0], v0.b[0]
1788+
; CHECK-GI-NEXT: mov b2, v0.b[0]
17891789
; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1
17901790
; CHECK-GI-NEXT: mov v2.b[1], v0.b[1]
17911791
; CHECK-GI-NEXT: mov v2.b[2], v0.b[2]

0 commit comments

Comments
 (0)