xref: /llvm-project/llvm/test/CodeGen/X86/GlobalISel/x86_64-select-ptrtoint.mir (revision 60442f0d442723a487528bdd8b48b24657a025e8)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
3
4--- |
5
6  define i1 @ptrtoint_s1_p0(ptr %p) {
7  entry:
8    %0 = ptrtoint ptr %p to i1
9    ret i1 %0
10  }
11
12  define i8 @ptrtoint_s8_p0(ptr %p) {
13  entry:
14    %0 = ptrtoint ptr %p to i8
15    ret i8 %0
16  }
17
18  define i16 @ptrtoint_s16_p0(ptr %p) {
19  entry:
20    %0 = ptrtoint ptr %p to i16
21    ret i16 %0
22  }
23
24  define i32 @ptrtoint_s32_p0(ptr %p) {
25  entry:
26    %0 = ptrtoint ptr %p to i32
27    ret i32 %0
28  }
29
30  define i64 @ptrtoint_s64_p0(ptr %p) {
31  entry:
32    %0 = ptrtoint ptr %p to i64
33    ret i64 %0
34  }
35
36...
37---
38name:            ptrtoint_s1_p0
39alignment:       16
40legalized:       true
41regBankSelected: true
42tracksRegLiveness: true
43registers:
44  - { id: 0, class: gpr }
45  - { id: 1, class: gpr }
46  - { id: 2, class: gpr }
47body:             |
48  bb.1.entry:
49    liveins: $rdi
50
51    ; CHECK-LABEL: name: ptrtoint_s1_p0
52    ; CHECK: liveins: $rdi
53    ; CHECK: [[COPY:%[0-9]+]]:gr64_with_sub_8bit = COPY $rdi
54    ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
55    ; CHECK: $al = COPY [[COPY1]]
56    ; CHECK: RET 0, implicit $al
57    %0:gpr(p0) = COPY $rdi
58    %1:gpr(s1) = G_PTRTOINT %0(p0)
59    %2:gpr(s8) = G_ANYEXT %1(s1)
60    $al = COPY %2(s8)
61    RET 0, implicit $al
62
63...
64---
65name:            ptrtoint_s8_p0
66alignment:       16
67legalized:       true
68regBankSelected: true
69tracksRegLiveness: true
70registers:
71  - { id: 0, class: gpr }
72  - { id: 1, class: gpr }
73body:             |
74  bb.1.entry:
75    liveins: $rdi
76
77    ; CHECK-LABEL: name: ptrtoint_s8_p0
78    ; CHECK: liveins: $rdi
79    ; CHECK: [[COPY:%[0-9]+]]:gr64_with_sub_8bit = COPY $rdi
80    ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
81    ; CHECK: $al = COPY [[COPY1]]
82    ; CHECK: RET 0, implicit $al
83    %0:gpr(p0) = COPY $rdi
84    %1:gpr(s8) = G_PTRTOINT %0(p0)
85    $al = COPY %1(s8)
86    RET 0, implicit $al
87
88...
89---
90name:            ptrtoint_s16_p0
91alignment:       16
92legalized:       true
93regBankSelected: true
94tracksRegLiveness: true
95registers:
96  - { id: 0, class: gpr }
97  - { id: 1, class: gpr }
98body:             |
99  bb.1.entry:
100    liveins: $rdi
101
102    ; CHECK-LABEL: name: ptrtoint_s16_p0
103    ; CHECK: liveins: $rdi
104    ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
105    ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
106    ; CHECK: $ax = COPY [[COPY1]]
107    ; CHECK: RET 0, implicit $ax
108    %0:gpr(p0) = COPY $rdi
109    %1:gpr(s16) = G_PTRTOINT %0(p0)
110    $ax = COPY %1(s16)
111    RET 0, implicit $ax
112
113...
114---
115name:            ptrtoint_s32_p0
116alignment:       16
117legalized:       true
118regBankSelected: true
119tracksRegLiveness: true
120registers:
121  - { id: 0, class: gpr }
122  - { id: 1, class: gpr }
123body:             |
124  bb.1.entry:
125    liveins: $rdi
126
127    ; CHECK-LABEL: name: ptrtoint_s32_p0
128    ; CHECK: liveins: $rdi
129    ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
130    ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY [[COPY]].sub_32bit
131    ; CHECK: $eax = COPY [[COPY1]]
132    ; CHECK: RET 0, implicit $eax
133    %0:gpr(p0) = COPY $rdi
134    %1:gpr(s32) = G_PTRTOINT %0(p0)
135    $eax = COPY %1(s32)
136    RET 0, implicit $eax
137
138...
139---
140name:            ptrtoint_s64_p0
141alignment:       16
142legalized:       true
143regBankSelected: true
144tracksRegLiveness: true
145registers:
146  - { id: 0, class: gpr }
147  - { id: 1, class: gpr }
148body:             |
149  bb.1.entry:
150    liveins: $rdi
151
152    ; CHECK-LABEL: name: ptrtoint_s64_p0
153    ; CHECK: liveins: $rdi
154    ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
155    ; CHECK: $rax = COPY [[COPY]]
156    ; CHECK: RET 0, implicit $rax
157    %0:gpr(p0) = COPY $rdi
158    %1:gpr(s64) = G_PTRTOINT %0(p0)
159    $rax = COPY %1(s64)
160    RET 0, implicit $rax
161
162...
163