]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/Mips/mips64load-store-left-right.ll
Vendor import of llvm RELEASE_34/dot1-final tag r208032 (effectively, 3.4.1 release):
[FreeBSD/FreeBSD.git] / test / CodeGen / Mips / mips64load-store-left-right.ll
1 ; RUN: llc -march=mips64el -mcpu=mips64 -mattr=n64 < %s | FileCheck  -check-prefix=EL %s
2 ; RUN: llc -march=mips64 -mcpu=mips64 -mattr=n64 < %s | FileCheck  -check-prefix=EB %s
3
4 %struct.SLL = type { i64 }
5 %struct.SI = type { i32 }
6 %struct.SUI = type { i32 }
7
8 @sll = common global %struct.SLL zeroinitializer, align 1
9 @si = common global %struct.SI zeroinitializer, align 1
10 @sui = common global %struct.SUI zeroinitializer, align 1
11
12 define i64 @foo_load_ll() nounwind readonly {
13 entry:
14 ; EL: ldl $[[R0:[0-9]+]], 7($[[R1:[0-9]+]])
15 ; EL: ldr $[[R0]], 0($[[R1]])
16 ; EB: ldl $[[R0:[0-9]+]], 0($[[R1:[0-9]+]])
17 ; EB: ldr $[[R0]], 7($[[R1]])
18
19   %0 = load i64* getelementptr inbounds (%struct.SLL* @sll, i64 0, i32 0), align 1
20   ret i64 %0
21 }
22
23 define i64 @foo_load_i() nounwind readonly {
24 entry:
25 ; EL: lwl $[[R0:[0-9]+]], 3($[[R1:[0-9]+]])
26 ; EL: lwr $[[R0]], 0($[[R1]])
27 ; EB: lwl $[[R0:[0-9]+]], 0($[[R1:[0-9]+]])
28 ; EB: lwr $[[R0]], 3($[[R1]])
29
30   %0 = load i32* getelementptr inbounds (%struct.SI* @si, i64 0, i32 0), align 1
31   %conv = sext i32 %0 to i64
32   ret i64 %conv
33 }
34
35 define i64 @foo_load_ui() nounwind readonly {
36 entry:
37 ; EL: lwl $[[R0:[0-9]+]], 3($[[R1:[0-9]+]])
38 ; EL: lwr $[[R0]], 0($[[R1]])
39 ; EL: daddiu $[[R2:[0-9]+]], $zero, 1
40 ; EL: dsll   $[[R3:[0-9]+]], $[[R2]], 32
41 ; EL: daddiu $[[R4:[0-9]+]], $[[R3]], -1
42 ; EL: and    ${{[0-9]+}}, $[[R0]], $[[R4]]
43 ; EB: lwl $[[R0:[0-9]+]], 0($[[R1:[0-9]+]])
44 ; EB: lwr $[[R0]], 3($[[R1]])
45
46
47   %0 = load i32* getelementptr inbounds (%struct.SUI* @sui, i64 0, i32 0), align 1
48   %conv = zext i32 %0 to i64
49   ret i64 %conv
50 }
51
52 define void @foo_store_ll(i64 %a) nounwind {
53 entry:
54 ; EL: sdl $[[R0:[0-9]+]], 7($[[R1:[0-9]+]])
55 ; EL: sdr $[[R0]], 0($[[R1]])
56 ; EB: sdl $[[R0:[0-9]+]], 0($[[R1:[0-9]+]])
57 ; EB: sdr $[[R0]], 7($[[R1]])
58
59   store i64 %a, i64* getelementptr inbounds (%struct.SLL* @sll, i64 0, i32 0), align 1
60   ret void
61 }
62
63 define void @foo_store_i(i32 %a) nounwind {
64 entry:
65 ; EL: swl $[[R0:[0-9]+]], 3($[[R1:[0-9]+]])
66 ; EL: swr $[[R0]], 0($[[R1]])
67 ; EB: swl $[[R0:[0-9]+]], 0($[[R1:[0-9]+]])
68 ; EB: swr $[[R0]], 3($[[R1]])
69
70   store i32 %a, i32* getelementptr inbounds (%struct.SI* @si, i64 0, i32 0), align 1
71   ret void
72 }
73