22; RUN: llc --mtriple=mipsisa32r6-linux-gnu < %s | FileCheck %s --check-prefix=MIPS32R6
33; RUN: llc --mtriple=mipsisa64r6-linux-gnu < %s | FileCheck %s --check-prefix=MIPS64R6
44
5- define nofpclass(nzero) float @f (float nofpclass(nan) %a , float nofpclass(nan) %b ) {
5+ %struct.f2 = type { float , float }
6+
7+
8+ define float @f (float nofpclass(nan) %a , float nofpclass(nan) %b ) {
69; MIPS32R6-LABEL: f:
710; MIPS32R6: # %bb.0: # %entry
811; MIPS32R6-NEXT: jr $ra
@@ -32,7 +35,6 @@ define { float, float } @struct({ float, float} nofpclass(nan) %a) {
3235 ret {float , float } %a
3336}
3437
35- %struct.f2 = type { float , float }
3638define %struct.f2 @m ([2 x float ] nofpclass(nan) %a0 , [2 x float ] nofpclass(nan) %a1 ) {
3739; MIPS32R6-LABEL: m:
3840; MIPS32R6: # %bb.0: # %entry
@@ -58,3 +60,127 @@ entry:
5860 %ret1 = insertvalue %struct.f2 %ret0 , float %max1 , 1
5961 ret %struct.f2 %ret1
6062}
63+
64+ define float @fS (float nofpclass(snan) %a , float nofpclass(snan) %b ) {
65+ ; MIPS32R6-LABEL: fS:
66+ ; MIPS32R6: # %bb.0: # %entry
67+ ; MIPS32R6-NEXT: jr $ra
68+ ; MIPS32R6-NEXT: max.s $f0, $f12, $f14
69+ ;
70+ ; MIPS64R6-LABEL: fS:
71+ ; MIPS64R6: # %bb.0: # %entry
72+ ; MIPS64R6-NEXT: jr $ra
73+ ; MIPS64R6-NEXT: max.s $f0, $f12, $f13
74+ entry:
75+ %cond = tail call float @llvm.maximumnum.f32 (float %a , float %b )
76+ ret float %cond
77+ }
78+
79+ define { float , float } @structS ({ float , float } nofpclass(snan) %a ) {
80+ ; MIPS32R6-LABEL: structS:
81+ ; MIPS32R6: # %bb.0:
82+ ; MIPS32R6-NEXT: mov.s $f2, $f14
83+ ; MIPS32R6-NEXT: jr $ra
84+ ; MIPS32R6-NEXT: mov.s $f0, $f12
85+ ;
86+ ; MIPS64R6-LABEL: structS:
87+ ; MIPS64R6: # %bb.0:
88+ ; MIPS64R6-NEXT: mov.s $f2, $f13
89+ ; MIPS64R6-NEXT: jr $ra
90+ ; MIPS64R6-NEXT: mov.s $f0, $f12
91+ ret {float , float } %a
92+ }
93+
94+ define %struct.f2 @mS ([2 x float ] nofpclass(snan) %a0 , [2 x float ] nofpclass(snan) %a1 ) {
95+ ; MIPS32R6-LABEL: mS:
96+ ; MIPS32R6: # %bb.0: # %entry
97+ ; MIPS32R6-NEXT: mtc1 $6, $f0
98+ ; MIPS32R6-NEXT: max.s $f0, $f12, $f0
99+ ; MIPS32R6-NEXT: mtc1 $7, $f1
100+ ; MIPS32R6-NEXT: jr $ra
101+ ; MIPS32R6-NEXT: max.s $f2, $f14, $f1
102+ ;
103+ ; MIPS64R6-LABEL: mS:
104+ ; MIPS64R6: # %bb.0: # %entry
105+ ; MIPS64R6-NEXT: max.s $f0, $f12, $f14
106+ ; MIPS64R6-NEXT: jr $ra
107+ ; MIPS64R6-NEXT: max.s $f2, $f13, $f15
108+ entry:
109+ %a0f0 = extractvalue [2 x float ] %a0 , 0
110+ %a0f1 = extractvalue [2 x float ] %a0 , 1
111+ %a1f0 = extractvalue [2 x float ] %a1 , 0
112+ %a1f1 = extractvalue [2 x float ] %a1 , 1
113+ %max0 = tail call float @llvm.maximumnum.f32 (float %a0f0 , float %a1f0 )
114+ %max1 = tail call float @llvm.maximumnum.f32 (float %a0f1 , float %a1f1 )
115+ %ret0 = insertvalue %struct.f2 poison, float %max0 , 0
116+ %ret1 = insertvalue %struct.f2 %ret0 , float %max1 , 1
117+ ret %struct.f2 %ret1
118+ }
119+
120+ define float @fQ (float nofpclass(qnan) %a , float nofpclass(qnan) %b ) {
121+ ; MIPS32R6-LABEL: fQ:
122+ ; MIPS32R6: # %bb.0: # %entry
123+ ; MIPS32R6-NEXT: min.s $f0, $f14, $f14
124+ ; MIPS32R6-NEXT: min.s $f1, $f12, $f12
125+ ; MIPS32R6-NEXT: jr $ra
126+ ; MIPS32R6-NEXT: max.s $f0, $f1, $f0
127+ ;
128+ ; MIPS64R6-LABEL: fQ:
129+ ; MIPS64R6: # %bb.0: # %entry
130+ ; MIPS64R6-NEXT: min.s $f0, $f13, $f13
131+ ; MIPS64R6-NEXT: min.s $f1, $f12, $f12
132+ ; MIPS64R6-NEXT: jr $ra
133+ ; MIPS64R6-NEXT: max.s $f0, $f1, $f0
134+ entry:
135+ %cond = tail call float @llvm.maximumnum.f32 (float %a , float %b )
136+ ret float %cond
137+ }
138+
139+ define { float , float } @structQ ({ float , float } nofpclass(qnan) %a ) {
140+ ; MIPS32R6-LABEL: structQ:
141+ ; MIPS32R6: # %bb.0:
142+ ; MIPS32R6-NEXT: mov.s $f2, $f14
143+ ; MIPS32R6-NEXT: jr $ra
144+ ; MIPS32R6-NEXT: mov.s $f0, $f12
145+ ;
146+ ; MIPS64R6-LABEL: structQ:
147+ ; MIPS64R6: # %bb.0:
148+ ; MIPS64R6-NEXT: mov.s $f2, $f13
149+ ; MIPS64R6-NEXT: jr $ra
150+ ; MIPS64R6-NEXT: mov.s $f0, $f12
151+ ret {float , float } %a
152+ }
153+
154+ define %struct.f2 @mQ ([2 x float ] nofpclass(qnan) %a0 , [2 x float ] nofpclass(qnan) %a1 ) {
155+ ; MIPS32R6-LABEL: mQ:
156+ ; MIPS32R6: # %bb.0: # %entry
157+ ; MIPS32R6-NEXT: min.s $f0, $f12, $f12
158+ ; MIPS32R6-NEXT: mtc1 $6, $f1
159+ ; MIPS32R6-NEXT: min.s $f1, $f1, $f1
160+ ; MIPS32R6-NEXT: max.s $f0, $f0, $f1
161+ ; MIPS32R6-NEXT: min.s $f1, $f14, $f14
162+ ; MIPS32R6-NEXT: mtc1 $7, $f2
163+ ; MIPS32R6-NEXT: min.s $f2, $f2, $f2
164+ ; MIPS32R6-NEXT: jr $ra
165+ ; MIPS32R6-NEXT: max.s $f2, $f1, $f2
166+ ;
167+ ; MIPS64R6-LABEL: mQ:
168+ ; MIPS64R6: # %bb.0: # %entry
169+ ; MIPS64R6-NEXT: min.s $f0, $f14, $f14
170+ ; MIPS64R6-NEXT: min.s $f1, $f12, $f12
171+ ; MIPS64R6-NEXT: max.s $f0, $f1, $f0
172+ ; MIPS64R6-NEXT: min.s $f1, $f15, $f15
173+ ; MIPS64R6-NEXT: min.s $f2, $f13, $f13
174+ ; MIPS64R6-NEXT: jr $ra
175+ ; MIPS64R6-NEXT: max.s $f2, $f2, $f1
176+ entry:
177+ %a0f0 = extractvalue [2 x float ] %a0 , 0
178+ %a0f1 = extractvalue [2 x float ] %a0 , 1
179+ %a1f0 = extractvalue [2 x float ] %a1 , 0
180+ %a1f1 = extractvalue [2 x float ] %a1 , 1
181+ %max0 = tail call float @llvm.maximumnum.f32 (float %a0f0 , float %a1f0 )
182+ %max1 = tail call float @llvm.maximumnum.f32 (float %a0f1 , float %a1f1 )
183+ %ret0 = insertvalue %struct.f2 poison, float %max0 , 0
184+ %ret1 = insertvalue %struct.f2 %ret0 , float %max1 , 1
185+ ret %struct.f2 %ret1
186+ }
0 commit comments