summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AArch64/GlobalISel/legalize-extracts.mir
blob: dc6b59b24a9aef5996ecb405a62b5f0ddac53133 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# RUN: llc -mtriple=aarch64-linux-gnu -O0 -run-pass=legalizer -global-isel %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: [[LO:%[0-9]+]](s64) = G_LOAD
    ; CHECK: {{%[0-9]+}}(s64) = G_LOAD
    ; CHECK: [[VAL:%[0-9]+]](s64) = COPY [[LO]]
    ; CHECK: G_STORE [[VAL]]
    %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: [[LO_TMP:%[0-9]+]](s64) = G_LOAD
    ; CHECK: [[HI:%[0-9]+]](s64) = G_LOAD
    ; CHECK: [[LO:%[0-9]+]](s64) = COPY [[LO_TMP]]
    ; CHECK: [[NEWHI_TMP:%[0-9]+]](s32) = G_EXTRACT [[HI]](s64), 0
    ; CHECK: [[NEWHI:%[0-9]+]](s32) = COPY [[NEWHI_TMP]]
    ; CHECK: G_STORE [[LO]]
    ; CHECK: G_STORE [[NEWHI]]
    %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: [[LO:%[0-9]+]](s32) = G_EXTRACT %0(s64), 32
    ; CHECK: [[HI:%[0-9]+]](s32) = G_EXTRACT %1(s64), 0
    ; CHECK: %3(s64) = G_MERGE_VALUES [[LO]](s32), [[HI]](s32)
    %0:_(s64) = COPY %x0
    %1:_(s64) = COPY %x1
    %2:_(s128) = G_MERGE_VALUES %0, %1
    %3:_(s64) = G_EXTRACT %2, 32
    RET_ReallyLR
...

---
name:            test_extracts_4
body: |
  bb.0:
    liveins: %x0, %x1, %x2


    ; CHECK-LABEL: name: test_extracts_4
    ; CHECK: [[LO_TMP:%[0-9]+]](s32) = G_EXTRACT %0(s64), 32
    ; CHECK: %3(s32) = COPY [[LO_TMP]]
    %0:_(s64) = COPY %x0
    %1:_(s64) = COPY %x1
    %2:_(s128) = G_MERGE_VALUES %0, %1
    %3:_(s32) = G_EXTRACT %2, 32
    RET_ReallyLR
...
OpenPOWER on IntegriCloud