1 ; RUN: llc < %s -march=mips64el -mcpu=mips4 -target-abi n64 -relocation-model=pic | FileCheck %s -check-prefix=CHECK-N64
2 ; RUN: llc < %s -march=mips64el -mcpu=mips4 -target-abi n32 -relocation-model=pic | FileCheck %s -check-prefix=CHECK-N32
3 ; RUN: llc < %s -march=mips64el -mcpu=mips64 -target-abi n64 -relocation-model=pic | FileCheck %s -check-prefix=CHECK-N64
4 ; RUN: llc < %s -march=mips64el -mcpu=mips64 -target-abi n32 -relocation-model=pic | FileCheck %s -check-prefix=CHECK-N32
6 @c = common global i8 0, align 4
7 @s = common global i16 0, align 4
8 @i = common global i32 0, align 4
9 @l = common global i64 0, align 8
10 @uc = common global i8 0, align 4
11 @us = common global i16 0, align 4
12 @ui = common global i32 0, align 4
13 @l1 = common global i64 0, align 8
15 define i64 @func1() nounwind readonly {
18 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(c)
19 ; CHECK-N64: lb ${{[0-9]+}}, 0($[[R0]])
21 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(c)
22 ; CHECK-N32: lb ${{[0-9]+}}, 0($[[R0]])
23 %0 = load i8, ptr @c, align 4
24 %conv = sext i8 %0 to i64
28 define i64 @func2() nounwind readonly {
31 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(s)
32 ; CHECK-N64: lh ${{[0-9]+}}, 0($[[R0]])
34 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(s)
35 ; CHECK-N32: lh ${{[0-9]+}}, 0($[[R0]])
36 %0 = load i16, ptr @s, align 4
37 %conv = sext i16 %0 to i64
41 define i64 @func3() nounwind readonly {
44 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(i)
45 ; CHECK-N64: lw ${{[0-9]+}}, 0($[[R0]])
47 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(i)
48 ; CHECK-N32: lw ${{[0-9]+}}, 0($[[R0]])
49 %0 = load i32, ptr @i, align 4
50 %conv = sext i32 %0 to i64
54 define i64 @func4() nounwind readonly {
57 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(l)
58 ; CHECK-N64: ld ${{[0-9]+}}, 0($[[R0]])
60 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(l)
61 ; CHECK-N32: ld ${{[0-9]+}}, 0($[[R0]])
62 %0 = load i64, ptr @l, align 8
66 define i64 @ufunc1() nounwind readonly {
69 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(uc)
70 ; CHECK-N64: lbu ${{[0-9]+}}, 0($[[R0]])
72 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(uc)
73 ; CHECK-N32: lbu ${{[0-9]+}}, 0($[[R0]])
74 %0 = load i8, ptr @uc, align 4
75 %conv = zext i8 %0 to i64
79 define i64 @ufunc2() nounwind readonly {
82 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(us)
83 ; CHECK-N64: lhu ${{[0-9]+}}, 0($[[R0]])
85 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(us)
86 ; CHECK-N32: lhu ${{[0-9]+}}, 0($[[R0]])
87 %0 = load i16, ptr @us, align 4
88 %conv = zext i16 %0 to i64
92 define i64 @ufunc3() nounwind readonly {
95 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(ui)
96 ; CHECK-N64: lwu ${{[0-9]+}}, 0($[[R0]])
98 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(ui)
99 ; CHECK-N32: lwu ${{[0-9]+}}, 0($[[R0]])
100 %0 = load i32, ptr @ui, align 4
101 %conv = zext i32 %0 to i64
105 define void @sfunc1() nounwind {
108 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(c)
109 ; CHECK-N64: sb ${{[0-9]+}}, 0($[[R0]])
111 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(c)
112 ; CHECK-N32: sb ${{[0-9]+}}, 0($[[R0]])
113 %0 = load i64, ptr @l1, align 8
114 %conv = trunc i64 %0 to i8
115 store i8 %conv, ptr @c, align 4
119 define void @sfunc2() nounwind {
122 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(s)
123 ; CHECK-N64: sh ${{[0-9]+}}, 0($[[R0]])
125 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(s)
126 ; CHECK-N32: sh ${{[0-9]+}}, 0($[[R0]])
127 %0 = load i64, ptr @l1, align 8
128 %conv = trunc i64 %0 to i16
129 store i16 %conv, ptr @s, align 4
133 define void @sfunc3() nounwind {
136 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(i)
137 ; CHECK-N64: sw ${{[0-9]+}}, 0($[[R0]])
139 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(i)
140 ; CHECK-N32: sw ${{[0-9]+}}, 0($[[R0]])
141 %0 = load i64, ptr @l1, align 8
142 %conv = trunc i64 %0 to i32
143 store i32 %conv, ptr @i, align 4
147 define void @sfunc4() nounwind {
150 ; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(l)
151 ; CHECK-N64: sd ${{[0-9]+}}, 0($[[R0]])
153 ; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(l)
154 ; CHECK-N32: sd ${{[0-9]+}}, 0($[[R0]])
155 %0 = load i64, ptr @l1, align 8
156 store i64 %0, ptr @l, align 8