blob: 3444254d070db65f26b76d274d33c32dd3c1e785 [file] [log] [blame]
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=aarch64-linux-gnu -O0 -run-pass=legalizer %s -o - | FileCheck %s
---
name: test_extracts_1
body: |
bb.0:
liveins: $w0
; Low part of extraction takes entirity of the low register entirely, so
; value stored is forwarded directly from first load.
; CHECK-LABEL: name: test_extracts_1
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x2
; CHECK: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[COPY]](p0) :: (load 8, align 16)
; 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: [[COPY1:%[0-9]+]]:_(s64) = COPY [[LOAD]](s64)
; CHECK: G_STORE [[COPY1]](s64), [[COPY]](p0) :: (store 8)
; CHECK: RET_ReallyLR
%0:_(s64) = COPY $x0
%1:_(s32) = COPY $w1
%2:_(p0) = COPY $x2
%3:_(s128) = G_LOAD %2(p0) :: (load 16)
%4:_(s64) = G_EXTRACT %3(s128), 0
G_STORE %4(s64), %2(p0) :: (store 8)
RET_ReallyLR
...
---
name: test_extracts_2
body: |
bb.0:
liveins: $w0
; Low extraction wipes takes whole low register. High extraction is real.
; CHECK-LABEL: name: test_extracts_2
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x2
; CHECK: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[COPY]](p0) :: (load 8, align 16)
; 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: [[COPY1:%[0-9]+]]:_(s64) = COPY [[LOAD]](s64)
; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[LOAD1]](s64), 0
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[EXTRACT]](s32)
; CHECK: G_STORE [[COPY1]](s64), [[COPY]](p0) :: (store 8)
; CHECK: G_STORE [[COPY2]](s32), [[COPY]](p0) :: (store 4)
; CHECK: RET_ReallyLR
%0:_(s64) = COPY $x0
%1:_(s32) = COPY $w1
%2:_(p0) = COPY $x2
%3:_(s128) = G_LOAD %2(p0) :: (load 16)
%4:_(s64) = G_EXTRACT %3(s128), 0
%5:_(s32) = G_EXTRACT %3(s128), 64
G_STORE %4(s64), %2(p0) :: (store 8)
G_STORE %5(s32), %2(p0) :: (store 4)
RET_ReallyLR
...
---
name: test_extracts_3
body: |
bb.0:
liveins: $x0, $x1, $x2
; CHECK-LABEL: name: test_extracts_3
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s64), 32
; CHECK: [[EXTRACT1:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY1]](s64), 0
; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[EXTRACT]](s32), [[EXTRACT1]](s32)
; CHECK: $x0 = COPY [[MV]](s64)
; CHECK: RET_ReallyLR
%0:_(s64) = COPY $x0
%1:_(s64) = COPY $x1
%2:_(s128) = G_MERGE_VALUES %0, %1
%3:_(s64) = G_EXTRACT %2, 32
$x0 = COPY %3
RET_ReallyLR
...
---
name: test_extracts_4
body: |
bb.0:
liveins: $x0, $x1, $x2
; CHECK-LABEL: name: test_extracts_4
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s64), 32
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[EXTRACT]](s32)
; CHECK: $w0 = COPY [[COPY1]](s32)
; CHECK: RET_ReallyLR
%0:_(s64) = COPY $x0
%1:_(s64) = COPY $x1
%2:_(s128) = G_MERGE_VALUES %0, %1
%3:_(s32) = G_EXTRACT %2, 32
$w0 = COPY %3
RET_ReallyLR
...