Skip to content

Commit

Permalink
[AArch64][GlobalISe] Select STRQui for stores into v264s instead of s…
Browse files Browse the repository at this point in the history
…calarizing

This improves selection for vector stores into v2s64s. Before we just
scalarized them, but we can just use a STRQui instead.

Differential Revision: https://reviews.llvm.org/D60083

llvm-svn: 357432
  • Loading branch information
Jessica Paquette committed Apr 1, 2019
1 parent dd245c4 commit e44c20a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
3 changes: 2 additions & 1 deletion llvm/lib/Target/AArch64/AArch64LegalizerInfo.cpp
Expand Up @@ -234,7 +234,8 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST) {
{s32, p0, 32, 8},
{s64, p0, 64, 8},
{p0, p0, 64, 8},
{v2s32, p0, 64, 8}})
{v2s32, p0, 64, 8},
{v2s64, p0, 128, 8}})
.clampScalar(0, s8, s64)
.widenScalarToNextPow2(0)
// TODO: We could support sum-of-pow2's but the lowering code doesn't know
Expand Down
Expand Up @@ -42,10 +42,8 @@ body: |
; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
; CHECK: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[COPY]], [[C]](s64)
; CHECK: [[LOAD1:%[0-9]+]]:_(s64) = G_LOAD [[GEP]](p0) :: (load 8)
; CHECK: G_STORE [[LOAD]](s64), [[COPY1]](p0) :: (store 8, align 16)
; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
; CHECK: [[GEP1:%[0-9]+]]:_(p0) = G_GEP [[COPY1]], [[C1]](s64)
; CHECK: G_STORE [[LOAD1]](s64), [[GEP1]](p0) :: (store 8)
; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[LOAD]](s64), [[LOAD1]](s64)
; CHECK: G_STORE [[BUILD_VECTOR]](<2 x s64>), [[COPY1]](p0) :: (store 16)
%0:_(p0) = COPY $x0
%1:_(p0) = COPY $x1
%2:_(<2 x s64>) = G_LOAD %0(p0) :: (load 16)
Expand Down
22 changes: 22 additions & 0 deletions llvm/test/CodeGen/AArch64/GlobalISel/select-store.mir
Expand Up @@ -29,6 +29,7 @@
define void @store_gep_8_s32_fpr(i32* %addr) { ret void }

define void @store_v2s32(i64 *%addr) { ret void }
define void @store_v2s64(i64 *%addr) { ret void }
...

---
Expand Down Expand Up @@ -418,3 +419,24 @@ body: |
G_STORE %1, %0 :: (store 8 into %ir.addr)
...
---
name: store_v2s64
legalized: true
regBankSelected: true

registers:
- { id: 0, class: gpr }
- { id: 1, class: fpr }

body: |
bb.0:
liveins: $x0, $d1
; CHECK-LABEL: name: store_v2s64
; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
; CHECK: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1
; CHECK: STRQui [[COPY1]], [[COPY]], 0 :: (store 16 into %ir.addr, align 8)
%0(p0) = COPY $x0
%1(<2 x s64>) = COPY $q1
G_STORE %1, %0 :: (store 16 into %ir.addr, align 8)
...

0 comments on commit e44c20a

Please sign in to comment.