xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/mips64intldst.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mips64el -mcpu=mips4 -target-abi n64 -relocation-model=pic | FileCheck %s -check-prefix=CHECK-N64
2*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mips64el -mcpu=mips4 -target-abi n32 -relocation-model=pic | FileCheck %s -check-prefix=CHECK-N32
3*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mips64el -mcpu=mips64 -target-abi n64 -relocation-model=pic | FileCheck %s -check-prefix=CHECK-N64
4*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -march=mips64el -mcpu=mips64 -target-abi n32 -relocation-model=pic | FileCheck %s -check-prefix=CHECK-N32
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker@c = common global i8 0, align 4
7*9880d681SAndroid Build Coastguard Worker@s = common global i16 0, align 4
8*9880d681SAndroid Build Coastguard Worker@i = common global i32 0, align 4
9*9880d681SAndroid Build Coastguard Worker@l = common global i64 0, align 8
10*9880d681SAndroid Build Coastguard Worker@uc = common global i8 0, align 4
11*9880d681SAndroid Build Coastguard Worker@us = common global i16 0, align 4
12*9880d681SAndroid Build Coastguard Worker@ui = common global i32 0, align 4
13*9880d681SAndroid Build Coastguard Worker@l1 = common global i64 0, align 8
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerdefine i64 @func1() nounwind readonly {
16*9880d681SAndroid Build Coastguard Workerentry:
17*9880d681SAndroid Build Coastguard Worker; CHECK-N64: func1
18*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(c)
19*9880d681SAndroid Build Coastguard Worker; CHECK-N64: lb ${{[0-9]+}}, 0($[[R0]])
20*9880d681SAndroid Build Coastguard Worker; CHECK-N32: func1
21*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(c)
22*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lb ${{[0-9]+}}, 0($[[R0]])
23*9880d681SAndroid Build Coastguard Worker  %0 = load i8, i8* @c, align 4
24*9880d681SAndroid Build Coastguard Worker  %conv = sext i8 %0 to i64
25*9880d681SAndroid Build Coastguard Worker  ret i64 %conv
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerdefine i64 @func2() nounwind readonly {
29*9880d681SAndroid Build Coastguard Workerentry:
30*9880d681SAndroid Build Coastguard Worker; CHECK-N64: func2
31*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(s)
32*9880d681SAndroid Build Coastguard Worker; CHECK-N64: lh ${{[0-9]+}}, 0($[[R0]])
33*9880d681SAndroid Build Coastguard Worker; CHECK-N32: func2
34*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(s)
35*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lh ${{[0-9]+}}, 0($[[R0]])
36*9880d681SAndroid Build Coastguard Worker  %0 = load i16, i16* @s, align 4
37*9880d681SAndroid Build Coastguard Worker  %conv = sext i16 %0 to i64
38*9880d681SAndroid Build Coastguard Worker  ret i64 %conv
39*9880d681SAndroid Build Coastguard Worker}
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Workerdefine i64 @func3() nounwind readonly {
42*9880d681SAndroid Build Coastguard Workerentry:
43*9880d681SAndroid Build Coastguard Worker; CHECK-N64: func3
44*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(i)
45*9880d681SAndroid Build Coastguard Worker; CHECK-N64: lw ${{[0-9]+}}, 0($[[R0]])
46*9880d681SAndroid Build Coastguard Worker; CHECK-N32: func3
47*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(i)
48*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw ${{[0-9]+}}, 0($[[R0]])
49*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32* @i, align 4
50*9880d681SAndroid Build Coastguard Worker  %conv = sext i32 %0 to i64
51*9880d681SAndroid Build Coastguard Worker  ret i64 %conv
52*9880d681SAndroid Build Coastguard Worker}
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerdefine i64 @func4() nounwind readonly {
55*9880d681SAndroid Build Coastguard Workerentry:
56*9880d681SAndroid Build Coastguard Worker; CHECK-N64: func4
57*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(l)
58*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld ${{[0-9]+}}, 0($[[R0]])
59*9880d681SAndroid Build Coastguard Worker; CHECK-N32: func4
60*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(l)
61*9880d681SAndroid Build Coastguard Worker; CHECK-N32: ld ${{[0-9]+}}, 0($[[R0]])
62*9880d681SAndroid Build Coastguard Worker  %0 = load i64, i64* @l, align 8
63*9880d681SAndroid Build Coastguard Worker  ret i64 %0
64*9880d681SAndroid Build Coastguard Worker}
65*9880d681SAndroid Build Coastguard Worker
66*9880d681SAndroid Build Coastguard Workerdefine i64 @ufunc1() nounwind readonly {
67*9880d681SAndroid Build Coastguard Workerentry:
68*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ufunc1
69*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(uc)
70*9880d681SAndroid Build Coastguard Worker; CHECK-N64: lbu ${{[0-9]+}}, 0($[[R0]])
71*9880d681SAndroid Build Coastguard Worker; CHECK-N32: ufunc1
72*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(uc)
73*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lbu ${{[0-9]+}}, 0($[[R0]])
74*9880d681SAndroid Build Coastguard Worker  %0 = load i8, i8* @uc, align 4
75*9880d681SAndroid Build Coastguard Worker  %conv = zext i8 %0 to i64
76*9880d681SAndroid Build Coastguard Worker  ret i64 %conv
77*9880d681SAndroid Build Coastguard Worker}
78*9880d681SAndroid Build Coastguard Worker
79*9880d681SAndroid Build Coastguard Workerdefine i64 @ufunc2() nounwind readonly {
80*9880d681SAndroid Build Coastguard Workerentry:
81*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ufunc2
82*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(us)
83*9880d681SAndroid Build Coastguard Worker; CHECK-N64: lhu ${{[0-9]+}}, 0($[[R0]])
84*9880d681SAndroid Build Coastguard Worker; CHECK-N32: ufunc2
85*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(us)
86*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lhu ${{[0-9]+}}, 0($[[R0]])
87*9880d681SAndroid Build Coastguard Worker  %0 = load i16, i16* @us, align 4
88*9880d681SAndroid Build Coastguard Worker  %conv = zext i16 %0 to i64
89*9880d681SAndroid Build Coastguard Worker  ret i64 %conv
90*9880d681SAndroid Build Coastguard Worker}
91*9880d681SAndroid Build Coastguard Worker
92*9880d681SAndroid Build Coastguard Workerdefine i64 @ufunc3() nounwind readonly {
93*9880d681SAndroid Build Coastguard Workerentry:
94*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ufunc3
95*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(ui)
96*9880d681SAndroid Build Coastguard Worker; CHECK-N64: lwu ${{[0-9]+}}, 0($[[R0]])
97*9880d681SAndroid Build Coastguard Worker; CHECK-N32: ufunc3
98*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(ui)
99*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lwu ${{[0-9]+}}, 0($[[R0]])
100*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32* @ui, align 4
101*9880d681SAndroid Build Coastguard Worker  %conv = zext i32 %0 to i64
102*9880d681SAndroid Build Coastguard Worker  ret i64 %conv
103*9880d681SAndroid Build Coastguard Worker}
104*9880d681SAndroid Build Coastguard Worker
105*9880d681SAndroid Build Coastguard Workerdefine void @sfunc1() nounwind {
106*9880d681SAndroid Build Coastguard Workerentry:
107*9880d681SAndroid Build Coastguard Worker; CHECK-N64: sfunc1
108*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(c)
109*9880d681SAndroid Build Coastguard Worker; CHECK-N64: sb ${{[0-9]+}}, 0($[[R0]])
110*9880d681SAndroid Build Coastguard Worker; CHECK-N32: sfunc1
111*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(c)
112*9880d681SAndroid Build Coastguard Worker; CHECK-N32: sb ${{[0-9]+}}, 0($[[R0]])
113*9880d681SAndroid Build Coastguard Worker  %0 = load i64, i64* @l1, align 8
114*9880d681SAndroid Build Coastguard Worker  %conv = trunc i64 %0 to i8
115*9880d681SAndroid Build Coastguard Worker  store i8 %conv, i8* @c, align 4
116*9880d681SAndroid Build Coastguard Worker  ret void
117*9880d681SAndroid Build Coastguard Worker}
118*9880d681SAndroid Build Coastguard Worker
119*9880d681SAndroid Build Coastguard Workerdefine void @sfunc2() nounwind {
120*9880d681SAndroid Build Coastguard Workerentry:
121*9880d681SAndroid Build Coastguard Worker; CHECK-N64: sfunc2
122*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(s)
123*9880d681SAndroid Build Coastguard Worker; CHECK-N64: sh ${{[0-9]+}}, 0($[[R0]])
124*9880d681SAndroid Build Coastguard Worker; CHECK-N32: sfunc2
125*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(s)
126*9880d681SAndroid Build Coastguard Worker; CHECK-N32: sh ${{[0-9]+}}, 0($[[R0]])
127*9880d681SAndroid Build Coastguard Worker  %0 = load i64, i64* @l1, align 8
128*9880d681SAndroid Build Coastguard Worker  %conv = trunc i64 %0 to i16
129*9880d681SAndroid Build Coastguard Worker  store i16 %conv, i16* @s, align 4
130*9880d681SAndroid Build Coastguard Worker  ret void
131*9880d681SAndroid Build Coastguard Worker}
132*9880d681SAndroid Build Coastguard Worker
133*9880d681SAndroid Build Coastguard Workerdefine void @sfunc3() nounwind {
134*9880d681SAndroid Build Coastguard Workerentry:
135*9880d681SAndroid Build Coastguard Worker; CHECK-N64: sfunc3
136*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(i)
137*9880d681SAndroid Build Coastguard Worker; CHECK-N64: sw ${{[0-9]+}}, 0($[[R0]])
138*9880d681SAndroid Build Coastguard Worker; CHECK-N32: sfunc3
139*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(i)
140*9880d681SAndroid Build Coastguard Worker; CHECK-N32: sw ${{[0-9]+}}, 0($[[R0]])
141*9880d681SAndroid Build Coastguard Worker  %0 = load i64, i64* @l1, align 8
142*9880d681SAndroid Build Coastguard Worker  %conv = trunc i64 %0 to i32
143*9880d681SAndroid Build Coastguard Worker  store i32 %conv, i32* @i, align 4
144*9880d681SAndroid Build Coastguard Worker  ret void
145*9880d681SAndroid Build Coastguard Worker}
146*9880d681SAndroid Build Coastguard Worker
147*9880d681SAndroid Build Coastguard Workerdefine void @sfunc4() nounwind {
148*9880d681SAndroid Build Coastguard Workerentry:
149*9880d681SAndroid Build Coastguard Worker; CHECK-N64: sfunc4
150*9880d681SAndroid Build Coastguard Worker; CHECK-N64: ld $[[R0:[0-9]+]], %got_disp(l)
151*9880d681SAndroid Build Coastguard Worker; CHECK-N64: sd ${{[0-9]+}}, 0($[[R0]])
152*9880d681SAndroid Build Coastguard Worker; CHECK-N32: sfunc4
153*9880d681SAndroid Build Coastguard Worker; CHECK-N32: lw $[[R0:[0-9]+]], %got_disp(l)
154*9880d681SAndroid Build Coastguard Worker; CHECK-N32: sd ${{[0-9]+}}, 0($[[R0]])
155*9880d681SAndroid Build Coastguard Worker  %0 = load i64, i64* @l1, align 8
156*9880d681SAndroid Build Coastguard Worker  store i64 %0, i64* @l, align 8
157*9880d681SAndroid Build Coastguard Worker  ret void
158*9880d681SAndroid Build Coastguard Worker}
159*9880d681SAndroid Build Coastguard Worker
160