blob: 9815ade1bab88cd7ce385e90b1d9a0eebbdfcc95 [file] [log] [blame]
Petar Jovanovice578e972016-04-11 15:24:23 +00001; RUN: llc < %s -march=mips -mcpu=mips2 -relocation-model=pic | FileCheck %s \
2; RUN: -check-prefix=GP32 -check-prefix=NOT-R6 -check-prefix=NOT-R2-R6
3; RUN: llc < %s -march=mips -mcpu=mips32 -relocation-model=pic | FileCheck %s \
4; RUN: -check-prefix=GP32 -check-prefix=NOT-R6 -check-prefix=NOT-R2-R6
5; RUN: llc < %s -march=mips -mcpu=mips32r2 -relocation-model=pic | FileCheck %s -check-prefix=GP32 \
Daniel Sanders17793142015-02-18 16:24:50 +00006; RUN: -check-prefix=R2-R5 -check-prefix=R2-R6 -check-prefix=NOT-R6
Petar Jovanovice578e972016-04-11 15:24:23 +00007; RUN: llc < %s -march=mips -mcpu=mips32r3 -relocation-model=pic | FileCheck %s -check-prefix=GP32 \
Daniel Sanders17793142015-02-18 16:24:50 +00008; RUN: -check-prefix=R2-R5 -check-prefix=R2-R6 -check-prefix=NOT-R6
Petar Jovanovice578e972016-04-11 15:24:23 +00009; RUN: llc < %s -march=mips -mcpu=mips32r5 -relocation-model=pic | FileCheck %s -check-prefix=GP32 \
Daniel Sanders17793142015-02-18 16:24:50 +000010; RUN: -check-prefix=R2-R5 -check-prefix=R2-R6 -check-prefix=NOT-R6
Petar Jovanovice578e972016-04-11 15:24:23 +000011; RUN: llc < %s -march=mips -mcpu=mips32r6 -relocation-model=pic | FileCheck %s \
Vasileios Kalintiris2ed214f2015-01-26 12:04:40 +000012; RUN: -check-prefix=GP32 -check-prefix=R6 -check-prefix=R2-R6
Petar Jovanovice578e972016-04-11 15:24:23 +000013; RUN: llc < %s -march=mips64 -mcpu=mips3 -relocation-model=pic | FileCheck %s \
Vasileios Kalintiris2ed214f2015-01-26 12:04:40 +000014; RUN: -check-prefix=GP64-NOT-R6 -check-prefix=NOT-R6 -check-prefix=NOT-R2-R6
Petar Jovanovice578e972016-04-11 15:24:23 +000015; RUN: llc < %s -march=mips64 -mcpu=mips4 -relocation-model=pic | FileCheck %s \
Vasileios Kalintiris2ed214f2015-01-26 12:04:40 +000016; RUN: -check-prefix=GP64-NOT-R6 -check-prefix=NOT-R6 -check-prefix=NOT-R2-R6
Petar Jovanovice578e972016-04-11 15:24:23 +000017; RUN: llc < %s -march=mips64 -mcpu=mips64 -relocation-model=pic | FileCheck %s \
Vasileios Kalintiris2ed214f2015-01-26 12:04:40 +000018; RUN: -check-prefix=GP64-NOT-R6 -check-prefix=NOT-R6 -check-prefix=NOT-R2-R6
Petar Jovanovice578e972016-04-11 15:24:23 +000019; RUN: llc < %s -march=mips64 -mcpu=mips64r2 -relocation-model=pic | FileCheck %s \
Daniel Sanders17793142015-02-18 16:24:50 +000020; RUN: -check-prefix=R2-R5 -check-prefix=R2-R6 \
21; RUN: -check-prefix=GP64-NOT-R6 -check-prefix=NOT-R6
Petar Jovanovice578e972016-04-11 15:24:23 +000022; RUN: llc < %s -march=mips64 -mcpu=mips64r3 -relocation-model=pic | FileCheck %s \
Daniel Sanders17793142015-02-18 16:24:50 +000023; RUN: -check-prefix=R2-R5 -check-prefix=R2-R6 \
24; RUN: -check-prefix=GP64-NOT-R6 -check-prefix=NOT-R6
Petar Jovanovice578e972016-04-11 15:24:23 +000025; RUN: llc < %s -march=mips64 -mcpu=mips64r5 -relocation-model=pic | FileCheck %s \
Daniel Sanders17793142015-02-18 16:24:50 +000026; RUN: -check-prefix=R2-R5 -check-prefix=R2-R6 \
Vasileios Kalintiris2ed214f2015-01-26 12:04:40 +000027; RUN: -check-prefix=GP64-NOT-R6 -check-prefix=NOT-R6
Petar Jovanovice578e972016-04-11 15:24:23 +000028; RUN: llc < %s -march=mips64 -mcpu=mips64r6 -relocation-model=pic | FileCheck %s \
Vasileios Kalintiris2ed214f2015-01-26 12:04:40 +000029; RUN: -check-prefix=64R6 -check-prefix=R6 -check-prefix=R2-R6
30
31define signext i1 @urem_i1(i1 signext %a, i1 signext %b) {
32entry:
33; ALL-LABEL: urem_i1:
34
35 ; NOT-R6: andi $[[T0:[0-9]+]], $5, 1
36 ; NOT-R6: andi $[[T1:[0-9]+]], $4, 1
37 ; NOT-R6: divu $zero, $[[T1]], $[[T0]]
38 ; NOT-R6: teq $[[T0]], $zero, 7
39 ; NOT-R6: mfhi $[[T2:[0-9]+]]
40 ; NOT-R6: sll $[[T3:[0-9]+]], $[[T2]], 31
41 ; NOT-R6: sra $2, $[[T3]], 31
42
43 ; R6: andi $[[T0:[0-9]+]], $5, 1
44 ; R6: andi $[[T1:[0-9]+]], $4, 1
45 ; R6: modu $[[T2:[0-9]+]], $[[T1]], $[[T0]]
46 ; R6: teq $[[T0]], $zero, 7
47 ; R6: sll $[[T3:[0-9]+]], $[[T2]], 31
48 ; R6: sra $2, $[[T3]], 31
49
50 %r = urem i1 %a, %b
51 ret i1 %r
52}
53
54define signext i8 @urem_i8(i8 signext %a, i8 signext %b) {
55entry:
56; ALL-LABEL: urem_i8:
57
58 ; NOT-R2-R6: andi $[[T0:[0-9]+]], $5, 255
59 ; NOT-R2-R6: andi $[[T1:[0-9]+]], $4, 255
60 ; NOT-R2-R6: divu $zero, $[[T1]], $[[T0]]
61 ; NOT-R2-R6: teq $[[T0]], $zero, 7
62 ; NOT-R2-R6: mfhi $[[T2:[0-9]+]]
63 ; NOT-R2-R6: sll $[[T3:[0-9]+]], $[[T2]], 24
64 ; NOT-R2-R6: sra $2, $[[T3]], 24
65
Daniel Sanders17793142015-02-18 16:24:50 +000066 ; R2-R5: andi $[[T0:[0-9]+]], $5, 255
67 ; R2-R5: andi $[[T1:[0-9]+]], $4, 255
68 ; R2-R5: divu $zero, $[[T1]], $[[T0]]
69 ; R2-R5: teq $[[T0]], $zero, 7
70 ; R2-R5: mfhi $[[T2:[0-9]+]]
71 ; R2-R5: seb $2, $[[T2]]
Vasileios Kalintiris2ed214f2015-01-26 12:04:40 +000072
73 ; R6: andi $[[T0:[0-9]+]], $5, 255
74 ; R6: andi $[[T1:[0-9]+]], $4, 255
75 ; R6: modu $[[T2:[0-9]+]], $[[T1]], $[[T0]]
76 ; R6: teq $[[T0]], $zero, 7
77 ; R6: seb $2, $[[T2]]
78
79 %r = urem i8 %a, %b
80 ret i8 %r
81}
82
83define signext i16 @urem_i16(i16 signext %a, i16 signext %b) {
84entry:
85; ALL-LABEL: urem_i16:
86
87 ; NOT-R2-R6: andi $[[T0:[0-9]+]], $5, 65535
88 ; NOT-R2-R6: andi $[[T1:[0-9]+]], $4, 65535
89 ; NOT-R2-R6: divu $zero, $[[T1]], $[[T0]]
90 ; NOT-R2-R6: teq $[[T0]], $zero, 7
91 ; NOT-R2-R6: mfhi $[[T2:[0-9]+]]
92 ; NOT-R2-R6: sll $[[T3:[0-9]+]], $[[T2]], 16
93 ; NOT-R2-R6: sra $2, $[[T3]], 16
94
Daniel Sanders17793142015-02-18 16:24:50 +000095 ; R2-R5: andi $[[T0:[0-9]+]], $5, 65535
96 ; R2-R5: andi $[[T1:[0-9]+]], $4, 65535
97 ; R2-R5: divu $zero, $[[T1]], $[[T0]]
98 ; R2-R5: teq $[[T0]], $zero, 7
99 ; R2-R5: mfhi $[[T3:[0-9]+]]
100 ; R2-R5: seh $2, $[[T2]]
Vasileios Kalintiris2ed214f2015-01-26 12:04:40 +0000101
102 ; R6: andi $[[T0:[0-9]+]], $5, 65535
103 ; R6: andi $[[T1:[0-9]+]], $4, 65535
104 ; R6: modu $[[T2:[0-9]+]], $[[T1]], $[[T0]]
105 ; R6: teq $[[T0]], $zero, 7
106 ; R6: seh $2, $[[T2]]
107
108 %r = urem i16 %a, %b
109 ret i16 %r
110}
111
112define signext i32 @urem_i32(i32 signext %a, i32 signext %b) {
113entry:
114; ALL-LABEL: urem_i32:
115
116 ; NOT-R6: divu $zero, $4, $5
117 ; NOT-R6: teq $5, $zero, 7
118 ; NOT-R6: mfhi $2
119
120 ; R6: modu $2, $4, $5
121 ; R6: teq $5, $zero, 7
122
123 %r = urem i32 %a, %b
124 ret i32 %r
125}
126
127define signext i64 @urem_i64(i64 signext %a, i64 signext %b) {
128entry:
129; ALL-LABEL: urem_i64:
130
131 ; GP32: lw $25, %call16(__umoddi3)($gp)
132
133 ; GP64-NOT-R6: ddivu $zero, $4, $5
134 ; GP64-NOT-R6: teq $5, $zero, 7
135 ; GP64-NOT-R6: mfhi $2
136
137 ; 64R6: dmodu $2, $4, $5
138 ; 64R6: teq $5, $zero, 7
139
140 %r = urem i64 %a, %b
141 ret i64 %r
142}
Vasileios Kalintirisef96a8e2015-01-26 12:33:22 +0000143
144define signext i128 @urem_i128(i128 signext %a, i128 signext %b) {
145entry:
146 ; ALL-LABEL: urem_i128:
147
Zoran Jovanovic2b7cc5a2016-04-02 23:06:13 +0000148 ; GP32: lw $25, %call16(__umodti3)($gp)
Vasileios Kalintirisef96a8e2015-01-26 12:33:22 +0000149
Zoran Jovanovic2b7cc5a2016-04-02 23:06:13 +0000150 ; GP64-NOT-R6: ld $25, %call16(__umodti3)($gp)
151 ; 64-R6: ld $25, %call16(__umodti3)($gp)
Vasileios Kalintirisef96a8e2015-01-26 12:33:22 +0000152
153 %r = urem i128 %a, %b
154 ret i128 %r
155}