1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -O0 -run-pass=legalizer %s -o - | FileCheck %s
3
4--- |
5  target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
6  target triple = "aarch64--"
7  define void @test_constant() {
8  entry:
9    ret void
10  }
11  define void @test_fconstant() {
12  entry:
13    ret void
14  }
15  @var = global i8 0
16  define i8* @test_global() { ret i8* undef }
17...
18
19---
20name:            test_constant
21registers:
22  - { id: 0, class: _ }
23  - { id: 1, class: _ }
24  - { id: 2, class: _ }
25  - { id: 3, class: _ }
26  - { id: 4, class: _ }
27  - { id: 5, class: _ }
28body: |
29  bb.0.entry:
30
31    ; CHECK-LABEL: name: test_constant
32    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
33    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY [[C]](s32)
34    ; CHECK: $w0 = COPY [[COPY]](s32)
35    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 42
36    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[C1]](s32)
37    ; CHECK: $w0 = COPY [[COPY1]](s32)
38    ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
39    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[C2]](s32)
40    ; CHECK: $w0 = COPY [[COPY2]](s32)
41    ; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
42    ; CHECK: $w0 = COPY [[C3]](s32)
43    ; CHECK: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
44    ; CHECK: $x0 = COPY [[C4]](s64)
45    ; CHECK: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
46    ; CHECK: $x0 = COPY [[C5]](s64)
47    %0(s1) = G_CONSTANT i1 0
48    %6:_(s32) = G_ANYEXT %0
49    $w0 = COPY %6
50    %1(s8) = G_CONSTANT i8 42
51    %7:_(s32) = G_ANYEXT %1
52    $w0 = COPY %7
53    %2(s16) = G_CONSTANT i16 65535
54    %8:_(s32) = G_ANYEXT %2
55    $w0 = COPY %8
56    %3(s32) = G_CONSTANT i32 -1
57    $w0 = COPY %3
58    %4(s64) = G_CONSTANT i64 1
59    $x0 = COPY %4
60    %5(s64) = G_CONSTANT i64 0
61    $x0 = COPY %5
62...
63
64---
65name:            test_fconstant
66registers:
67  - { id: 0, class: _ }
68  - { id: 1, class: _ }
69  - { id: 2, class: _ }
70body: |
71  bb.0.entry:
72
73    ; CHECK-LABEL: name: test_fconstant
74    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
75    ; CHECK: $w0 = COPY [[C]](s32)
76    ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+00
77    ; CHECK: $x0 = COPY [[C1]](s64)
78    ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
79    ; CHECK: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[C2]](s32)
80    ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[FPTRUNC]](s16)
81    ; CHECK: $w0 = COPY [[ANYEXT]](s32)
82    %0(s32) = G_FCONSTANT float 1.0
83    $w0 = COPY %0
84    %1(s64) = G_FCONSTANT double 2.0
85    $x0 = COPY %1
86    %2(s16) = G_FCONSTANT half 0.0
87    %3:_(s32) = G_ANYEXT %2
88    $w0 = COPY %3
89...
90
91---
92name:            test_global
93registers:
94  - { id: 0, class: _ }
95body: |
96  bb.0:
97
98    ; CHECK-LABEL: name: test_global
99    ; CHECK: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @var
100    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[GV]](p0)
101    ; CHECK: $x0 = COPY [[PTRTOINT]](s64)
102    %0(p0) = G_GLOBAL_VALUE @var
103    %1:_(s64) = G_PTRTOINT %0
104    $x0 = COPY %1
105...
106