1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=SSE_FAST
3 ; RUN: llc -mtriple=x86_64-linux-gnu -regbankselect-greedy -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=SSE_GREEDY
5 define i1 @test_load_i1(i1 * %p1) {
6 ; ALL-LABEL: test_load_i1:
8 ; ALL-NEXT: movb (%rdi), %al
14 define i8 @test_load_i8(i8 * %p1) {
15 ; ALL-LABEL: test_load_i8:
17 ; ALL-NEXT: movb (%rdi), %al
23 define i16 @test_load_i16(i16 * %p1) {
24 ; ALL-LABEL: test_load_i16:
26 ; ALL-NEXT: movzwl (%rdi), %eax
28 %r = load i16, i16* %p1
32 define i32 @test_load_i32(i32 * %p1) {
33 ; ALL-LABEL: test_load_i32:
35 ; ALL-NEXT: movl (%rdi), %eax
37 %r = load i32, i32* %p1
41 define i64 @test_load_i64(i64 * %p1) {
42 ; ALL-LABEL: test_load_i64:
44 ; ALL-NEXT: movq (%rdi), %rax
46 %r = load i64, i64* %p1
50 define float @test_load_float(float * %p1) {
51 ; SSE-LABEL: test_load_float:
53 ; SSE-NEXT: movl (%rdi), %eax
54 ; SSE-NEXT: movd %eax, %xmm0
57 ; ALL-LABEL: test_load_float:
59 ; ALL-NEXT: movl (%rdi), %eax
60 ; ALL-NEXT: movd %eax, %xmm0
62 %r = load float, float* %p1
66 define double @test_load_double(double * %p1) {
67 ; SSE-LABEL: test_load_double:
69 ; SSE-NEXT: movq (%rdi), %rax
70 ; SSE-NEXT: movq %rax, %xmm0
73 ; ALL-LABEL: test_load_double:
75 ; ALL-NEXT: movq (%rdi), %rax
76 ; ALL-NEXT: movq %rax, %xmm0
78 %r = load double, double* %p1
82 define i1 * @test_store_i1(i1 %val, i1 * %p1) {
83 ; ALL-LABEL: test_store_i1:
85 ; ALL-NEXT: movq %rsi, %rax
86 ; ALL-NEXT: andb $1, %dil
87 ; ALL-NEXT: movb %dil, (%rsi)
89 store i1 %val, i1* %p1
93 define i32 * @test_store_i32(i32 %val, i32 * %p1) {
94 ; ALL-LABEL: test_store_i32:
96 ; ALL-NEXT: movq %rsi, %rax
97 ; ALL-NEXT: movl %edi, (%rsi)
99 store i32 %val, i32* %p1
103 define i64 * @test_store_i64(i64 %val, i64 * %p1) {
104 ; ALL-LABEL: test_store_i64:
106 ; ALL-NEXT: movq %rsi, %rax
107 ; ALL-NEXT: movq %rdi, (%rsi)
109 store i64 %val, i64* %p1
113 define float * @test_store_float(float %val, float * %p1) {
115 ; SSE_FAST-LABEL: test_store_float:
117 ; SSE_FAST-NEXT: movq %rdi, %rax
118 ; SSE_FAST-NEXT: movd %xmm0, %ecx
119 ; SSE_FAST-NEXT: movl %ecx, (%rdi)
120 ; SSE_FAST-NEXT: retq
122 ; SSE_GREEDY-LABEL: test_store_float:
123 ; SSE_GREEDY: # %bb.0:
124 ; SSE_GREEDY-NEXT: movq %rdi, %rax
125 ; SSE_GREEDY-NEXT: movss %xmm0, (%rdi)
126 ; SSE_GREEDY-NEXT: retq
127 store float %val, float* %p1
131 define double * @test_store_double(double %val, double * %p1) {
133 ; SSE_FAST-LABEL: test_store_double:
135 ; SSE_FAST-NEXT: movq %rdi, %rax
136 ; SSE_FAST-NEXT: movq %xmm0, %rcx
137 ; SSE_FAST-NEXT: movq %rcx, (%rdi)
138 ; SSE_FAST-NEXT: retq
140 ; SSE_GREEDY-LABEL: test_store_double:
141 ; SSE_GREEDY: # %bb.0:
142 ; SSE_GREEDY-NEXT: movq %rdi, %rax
143 ; SSE_GREEDY-NEXT: movsd %xmm0, (%rdi)
144 ; SSE_GREEDY-NEXT: retq
145 store double %val, double* %p1
149 define i32* @test_load_ptr(i32** %ptr1) {
150 ; ALL-LABEL: test_load_ptr:
152 ; ALL-NEXT: movq (%rdi), %rax
154 %p = load i32*, i32** %ptr1
158 define void @test_store_ptr(i32** %ptr1, i32* %a) {
159 ; ALL-LABEL: test_store_ptr:
161 ; ALL-NEXT: movq %rsi, (%rdi)
163 store i32* %a, i32** %ptr1
167 define i32 @test_gep_folding(i32* %arr, i32 %val) {
168 ; ALL-LABEL: test_gep_folding:
170 ; ALL-NEXT: movl %esi, 20(%rdi)
171 ; ALL-NEXT: movl 20(%rdi), %eax
173 %arrayidx = getelementptr i32, i32* %arr, i32 5
174 store i32 %val, i32* %arrayidx
175 %r = load i32, i32* %arrayidx
179 ; check that gep index doesn't folded into memory operand
180 define i32 @test_gep_folding_largeGepIndex(i32* %arr, i32 %val) {
181 ; ALL-LABEL: test_gep_folding_largeGepIndex:
183 ; ALL-NEXT: movabsq $228719476720, %rax # imm = 0x3540BE3FF0
184 ; ALL-NEXT: addq %rdi, %rax
185 ; ALL-NEXT: movl %esi, (%rax)
186 ; ALL-NEXT: movl (%rax), %eax
188 %arrayidx = getelementptr i32, i32* %arr, i64 57179869180
189 store i32 %val, i32* %arrayidx
190 %r = load i32, i32* %arrayidx