Skip to content

Commit 7911692

Browse files
committed
Test both array and struct
1 parent 430f146 commit 7911692

File tree

2 files changed

+153
-80
lines changed

2 files changed

+153
-80
lines changed

llvm/test/CodeGen/AArch64/nofpclass.ll

Lines changed: 64 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
22
; RUN: llc --mtriple=aarch64-linux-gnu < %s | FileCheck %s
33

4-
%struct.f2 = type { float, float }
5-
64
define float @f(float nofpclass(nan) %a, float nofpclass(nan) %b) {
75
; CHECK-LABEL: f:
86
; CHECK: // %bb.0: // %entry
@@ -23,15 +21,26 @@ entry:
2321
ret <4 x float> %c
2422
}
2523

26-
define { float, float } @struct({ float, float} nofpclass(nan) %a) {
27-
; CHECK-LABEL: struct:
28-
; CHECK: // %bb.0:
24+
define {float, float} @m({float, float} nofpclass(nan) %a0, {float, float} nofpclass(nan) %a1) {
25+
; CHECK-LABEL: m:
26+
; CHECK: // %bb.0: // %entry
27+
; CHECK-NEXT: fmaxnm s1, s1, s3
28+
; CHECK-NEXT: fmaxnm s0, s0, s2
2929
; CHECK-NEXT: ret
30-
ret {float, float} %a
30+
entry:
31+
%a0f0 = extractvalue {float, float} %a0, 0
32+
%a0f1 = extractvalue {float, float} %a0, 1
33+
%a1f0 = extractvalue {float, float} %a1, 0
34+
%a1f1 = extractvalue {float, float} %a1, 1
35+
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
36+
%max1 = tail call float @llvm.maximumnum.f32(float %a0f1, float %a1f1)
37+
%ret0 = insertvalue {float, float} poison, float %max0, 0
38+
%ret1 = insertvalue {float, float} %ret0, float %max1, 1
39+
ret {float, float} %ret1
3140
}
3241

33-
define %struct.f2 @m([2 x float] nofpclass(nan) %a0, [2 x float] nofpclass(nan) %a1) {
34-
; CHECK-LABEL: m:
42+
define [2 x float] @mA([2 x float] nofpclass(nan) %a0, [2 x float] nofpclass(nan) %a1) {
43+
; CHECK-LABEL: mA:
3544
; CHECK: // %bb.0: // %entry
3645
; CHECK-NEXT: fmaxnm s1, s1, s3
3746
; CHECK-NEXT: fmaxnm s0, s0, s2
@@ -43,9 +52,9 @@ entry:
4352
%a1f1 = extractvalue [2 x float] %a1, 1
4453
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
4554
%max1 = tail call float @llvm.maximumnum.f32(float %a0f1, float %a1f1)
46-
%ret0 = insertvalue %struct.f2 poison, float %max0, 0
47-
%ret1 = insertvalue %struct.f2 %ret0, float %max1, 1
48-
ret %struct.f2 %ret1
55+
%ret0 = insertvalue [2 x float] poison, float %max0, 0
56+
%ret1 = insertvalue [2 x float] %ret0, float %max1, 1
57+
ret [2 x float] %ret1
4958
}
5059

5160
define float @fS(float nofpclass(snan) %a, float nofpclass(snan) %b) {
@@ -68,15 +77,26 @@ entry:
6877
ret <4 x float> %c
6978
}
7079

71-
define { float, float } @structS({ float, float} nofpclass(snan) %a) {
72-
; CHECK-LABEL: structS:
73-
; CHECK: // %bb.0:
80+
define {float, float} @mS({float, float} nofpclass(snan) %a0, {float, float} nofpclass(snan) %a1) {
81+
; CHECK-LABEL: mS:
82+
; CHECK: // %bb.0: // %entry
83+
; CHECK-NEXT: fmaxnm s1, s1, s3
84+
; CHECK-NEXT: fmaxnm s0, s0, s2
7485
; CHECK-NEXT: ret
75-
ret {float, float} %a
86+
entry:
87+
%a0f0 = extractvalue {float, float} %a0, 0
88+
%a0f1 = extractvalue {float, float} %a0, 1
89+
%a1f0 = extractvalue {float, float} %a1, 0
90+
%a1f1 = extractvalue {float, float} %a1, 1
91+
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
92+
%max1 = tail call float @llvm.maximumnum.f32(float %a0f1, float %a1f1)
93+
%ret0 = insertvalue {float, float} poison, float %max0, 0
94+
%ret1 = insertvalue {float, float} %ret0, float %max1, 1
95+
ret {float, float} %ret1
7696
}
7797

78-
define %struct.f2 @mS([2 x float] nofpclass(snan) %a0, [2 x float] nofpclass(snan) %a1) {
79-
; CHECK-LABEL: mS:
98+
define [2 x float] @mAS([2 x float] nofpclass(snan) %a0, [2 x float] nofpclass(snan) %a1) {
99+
; CHECK-LABEL: mAS:
80100
; CHECK: // %bb.0: // %entry
81101
; CHECK-NEXT: fmaxnm s1, s1, s3
82102
; CHECK-NEXT: fmaxnm s0, s0, s2
@@ -88,9 +108,9 @@ entry:
88108
%a1f1 = extractvalue [2 x float] %a1, 1
89109
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
90110
%max1 = tail call float @llvm.maximumnum.f32(float %a0f1, float %a1f1)
91-
%ret0 = insertvalue %struct.f2 poison, float %max0, 0
92-
%ret1 = insertvalue %struct.f2 %ret0, float %max1, 1
93-
ret %struct.f2 %ret1
111+
%ret0 = insertvalue [2 x float] poison, float %max0, 0
112+
%ret1 = insertvalue [2 x float] %ret0, float %max1, 1
113+
ret [2 x float] %ret1
94114
}
95115

96116
define float @fQ(float nofpclass(qnan) %a, float nofpclass(qnan) %b) {
@@ -117,15 +137,30 @@ entry:
117137
ret <4 x float> %c
118138
}
119139

120-
define { float, float } @structQ({ float, float} nofpclass(qnan) %a) {
121-
; CHECK-LABEL: structQ:
122-
; CHECK: // %bb.0:
140+
define {float, float} @mQ({float, float} nofpclass(qnan) %a0, {float, float} nofpclass(qnan) %a1) {
141+
; CHECK-LABEL: mQ:
142+
; CHECK: // %bb.0: // %entry
143+
; CHECK-NEXT: fminnm s2, s2, s2
144+
; CHECK-NEXT: fminnm s0, s0, s0
145+
; CHECK-NEXT: fminnm s3, s3, s3
146+
; CHECK-NEXT: fminnm s1, s1, s1
147+
; CHECK-NEXT: fmaxnm s0, s0, s2
148+
; CHECK-NEXT: fmaxnm s1, s1, s3
123149
; CHECK-NEXT: ret
124-
ret {float, float} %a
150+
entry:
151+
%a0f0 = extractvalue {float, float} %a0, 0
152+
%a0f1 = extractvalue {float, float} %a0, 1
153+
%a1f0 = extractvalue {float, float} %a1, 0
154+
%a1f1 = extractvalue {float, float} %a1, 1
155+
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
156+
%max1 = tail call float @llvm.maximumnum.f32(float %a0f1, float %a1f1)
157+
%ret0 = insertvalue {float, float} poison, float %max0, 0
158+
%ret1 = insertvalue {float, float} %ret0, float %max1, 1
159+
ret {float, float} %ret1
125160
}
126161

127-
define %struct.f2 @mQ([2 x float] nofpclass(qnan) %a0, [2 x float] nofpclass(qnan) %a1) {
128-
; CHECK-LABEL: mQ:
162+
define [2 x float] @mAQ([2 x float] nofpclass(qnan) %a0, [2 x float] nofpclass(qnan) %a1) {
163+
; CHECK-LABEL: mAQ:
129164
; CHECK: // %bb.0: // %entry
130165
; CHECK-NEXT: fminnm s2, s2, s2
131166
; CHECK-NEXT: fminnm s0, s0, s0
@@ -141,7 +176,7 @@ entry:
141176
%a1f1 = extractvalue [2 x float] %a1, 1
142177
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
143178
%max1 = tail call float @llvm.maximumnum.f32(float %a0f1, float %a1f1)
144-
%ret0 = insertvalue %struct.f2 poison, float %max0, 0
145-
%ret1 = insertvalue %struct.f2 %ret0, float %max1, 1
146-
ret %struct.f2 %ret1
179+
%ret0 = insertvalue [2 x float] poison, float %max0, 0
180+
%ret1 = insertvalue [2 x float] %ret0, float %max1, 1
181+
ret [2 x float] %ret1
147182
}

llvm/test/CodeGen/Mips/nofpclass.ll

Lines changed: 89 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
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-
%struct.f2 = type { float, float }
6-
7-
85
define float @f(float nofpclass(nan) %a, float nofpclass(nan) %b) {
96
; MIPS32R6-LABEL: f:
107
; MIPS32R6: # %bb.0: # %entry
@@ -20,31 +17,42 @@ entry:
2017
ret float %cond
2118
}
2219

23-
define { float, float } @struct({ float, float} nofpclass(nan) %a) {
24-
; MIPS32R6-LABEL: struct:
25-
; MIPS32R6: # %bb.0:
26-
; MIPS32R6-NEXT: mov.s $f2, $f14
20+
define {float, float} @m({float, float} nofpclass(nan) %a0, {float, float} nofpclass(nan) %a1) {
21+
; MIPS32R6-LABEL: m:
22+
; MIPS32R6: # %bb.0: # %entry
23+
; MIPS32R6-NEXT: mtc1 $6, $f0
24+
; MIPS32R6-NEXT: max.s $f0, $f12, $f0
25+
; MIPS32R6-NEXT: mtc1 $7, $f1
2726
; MIPS32R6-NEXT: jr $ra
28-
; MIPS32R6-NEXT: mov.s $f0, $f12
27+
; MIPS32R6-NEXT: max.s $f2, $f14, $f1
2928
;
30-
; MIPS64R6-LABEL: struct:
31-
; MIPS64R6: # %bb.0:
32-
; MIPS64R6-NEXT: mov.s $f2, $f13
29+
; MIPS64R6-LABEL: m:
30+
; MIPS64R6: # %bb.0: # %entry
31+
; MIPS64R6-NEXT: max.s $f0, $f12, $f14
3332
; MIPS64R6-NEXT: jr $ra
34-
; MIPS64R6-NEXT: mov.s $f0, $f12
35-
ret {float, float} %a
33+
; MIPS64R6-NEXT: max.s $f2, $f13, $f15
34+
entry:
35+
%a0f0 = extractvalue {float, float} %a0, 0
36+
%a0f1 = extractvalue {float, float} %a0, 1
37+
%a1f0 = extractvalue {float, float} %a1, 0
38+
%a1f1 = extractvalue {float, float} %a1, 1
39+
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
40+
%max1 = tail call float @llvm.maximumnum.f32(float %a0f1, float %a1f1)
41+
%ret0 = insertvalue {float, float} poison, float %max0, 0
42+
%ret1 = insertvalue {float, float} %ret0, float %max1, 1
43+
ret {float, float} %ret1
3644
}
3745

38-
define %struct.f2 @m([2 x float] nofpclass(nan) %a0, [2 x float] nofpclass(nan) %a1) {
39-
; MIPS32R6-LABEL: m:
46+
define [2 x float] @mA([2 x float] nofpclass(nan) %a0, [2 x float] nofpclass(nan) %a1) {
47+
; MIPS32R6-LABEL: mA:
4048
; MIPS32R6: # %bb.0: # %entry
4149
; MIPS32R6-NEXT: mtc1 $6, $f0
4250
; MIPS32R6-NEXT: max.s $f0, $f12, $f0
4351
; MIPS32R6-NEXT: mtc1 $7, $f1
4452
; MIPS32R6-NEXT: jr $ra
4553
; MIPS32R6-NEXT: max.s $f2, $f14, $f1
4654
;
47-
; MIPS64R6-LABEL: m:
55+
; MIPS64R6-LABEL: mA:
4856
; MIPS64R6: # %bb.0: # %entry
4957
; MIPS64R6-NEXT: max.s $f0, $f12, $f14
5058
; MIPS64R6-NEXT: jr $ra
@@ -56,9 +64,9 @@ entry:
5664
%a1f1 = extractvalue [2 x float] %a1, 1
5765
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
5866
%max1 = tail call float @llvm.maximumnum.f32(float %a0f1, float %a1f1)
59-
%ret0 = insertvalue %struct.f2 poison, float %max0, 0
60-
%ret1 = insertvalue %struct.f2 %ret0, float %max1, 1
61-
ret %struct.f2 %ret1
67+
%ret0 = insertvalue [2 x float] poison, float %max0, 0
68+
%ret1 = insertvalue [2 x float] %ret0, float %max1, 1
69+
ret [2 x float] %ret1
6270
}
6371

6472
define float @fS(float nofpclass(snan) %a, float nofpclass(snan) %b) {
@@ -76,31 +84,42 @@ entry:
7684
ret float %cond
7785
}
7886

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
87+
define {float, float} @mS({float, float} nofpclass(snan) %a0, {float, float} nofpclass(snan) %a1) {
88+
; MIPS32R6-LABEL: mS:
89+
; MIPS32R6: # %bb.0: # %entry
90+
; MIPS32R6-NEXT: mtc1 $6, $f0
91+
; MIPS32R6-NEXT: max.s $f0, $f12, $f0
92+
; MIPS32R6-NEXT: mtc1 $7, $f1
8393
; MIPS32R6-NEXT: jr $ra
84-
; MIPS32R6-NEXT: mov.s $f0, $f12
94+
; MIPS32R6-NEXT: max.s $f2, $f14, $f1
8595
;
86-
; MIPS64R6-LABEL: structS:
87-
; MIPS64R6: # %bb.0:
88-
; MIPS64R6-NEXT: mov.s $f2, $f13
96+
; MIPS64R6-LABEL: mS:
97+
; MIPS64R6: # %bb.0: # %entry
98+
; MIPS64R6-NEXT: max.s $f0, $f12, $f14
8999
; MIPS64R6-NEXT: jr $ra
90-
; MIPS64R6-NEXT: mov.s $f0, $f12
91-
ret {float, float} %a
100+
; MIPS64R6-NEXT: max.s $f2, $f13, $f15
101+
entry:
102+
%a0f0 = extractvalue {float, float} %a0, 0
103+
%a0f1 = extractvalue {float, float} %a0, 1
104+
%a1f0 = extractvalue {float, float} %a1, 0
105+
%a1f1 = extractvalue {float, float} %a1, 1
106+
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
107+
%max1 = tail call float @llvm.maximumnum.f32(float %a0f1, float %a1f1)
108+
%ret0 = insertvalue {float, float} poison, float %max0, 0
109+
%ret1 = insertvalue {float, float} %ret0, float %max1, 1
110+
ret {float, float} %ret1
92111
}
93112

94-
define %struct.f2 @mS([2 x float] nofpclass(snan) %a0, [2 x float] nofpclass(snan) %a1) {
95-
; MIPS32R6-LABEL: mS:
113+
define [2 x float] @mAS([2 x float] nofpclass(snan) %a0, [2 x float] nofpclass(snan) %a1) {
114+
; MIPS32R6-LABEL: mAS:
96115
; MIPS32R6: # %bb.0: # %entry
97116
; MIPS32R6-NEXT: mtc1 $6, $f0
98117
; MIPS32R6-NEXT: max.s $f0, $f12, $f0
99118
; MIPS32R6-NEXT: mtc1 $7, $f1
100119
; MIPS32R6-NEXT: jr $ra
101120
; MIPS32R6-NEXT: max.s $f2, $f14, $f1
102121
;
103-
; MIPS64R6-LABEL: mS:
122+
; MIPS64R6-LABEL: mAS:
104123
; MIPS64R6: # %bb.0: # %entry
105124
; MIPS64R6-NEXT: max.s $f0, $f12, $f14
106125
; MIPS64R6-NEXT: jr $ra
@@ -112,9 +131,9 @@ entry:
112131
%a1f1 = extractvalue [2 x float] %a1, 1
113132
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
114133
%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
134+
%ret0 = insertvalue [2 x float] poison, float %max0, 0
135+
%ret1 = insertvalue [2 x float] %ret0, float %max1, 1
136+
ret [2 x float] %ret1
118137
}
119138

120139
define float @fQ(float nofpclass(qnan) %a, float nofpclass(qnan) %b) {
@@ -136,23 +155,42 @@ entry:
136155
ret float %cond
137156
}
138157

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
158+
define {float, float} @mQ({float, float} nofpclass(qnan) %a0, {float, float} nofpclass(qnan) %a1) {
159+
; MIPS32R6-LABEL: mQ:
160+
; MIPS32R6: # %bb.0: # %entry
161+
; MIPS32R6-NEXT: min.s $f0, $f12, $f12
162+
; MIPS32R6-NEXT: mtc1 $6, $f1
163+
; MIPS32R6-NEXT: min.s $f1, $f1, $f1
164+
; MIPS32R6-NEXT: max.s $f0, $f0, $f1
165+
; MIPS32R6-NEXT: min.s $f1, $f14, $f14
166+
; MIPS32R6-NEXT: mtc1 $7, $f2
167+
; MIPS32R6-NEXT: min.s $f2, $f2, $f2
143168
; MIPS32R6-NEXT: jr $ra
144-
; MIPS32R6-NEXT: mov.s $f0, $f12
169+
; MIPS32R6-NEXT: max.s $f2, $f1, $f2
145170
;
146-
; MIPS64R6-LABEL: structQ:
147-
; MIPS64R6: # %bb.0:
148-
; MIPS64R6-NEXT: mov.s $f2, $f13
171+
; MIPS64R6-LABEL: mQ:
172+
; MIPS64R6: # %bb.0: # %entry
173+
; MIPS64R6-NEXT: min.s $f0, $f14, $f14
174+
; MIPS64R6-NEXT: min.s $f1, $f12, $f12
175+
; MIPS64R6-NEXT: max.s $f0, $f1, $f0
176+
; MIPS64R6-NEXT: min.s $f1, $f15, $f15
177+
; MIPS64R6-NEXT: min.s $f2, $f13, $f13
149178
; MIPS64R6-NEXT: jr $ra
150-
; MIPS64R6-NEXT: mov.s $f0, $f12
151-
ret {float, float} %a
179+
; MIPS64R6-NEXT: max.s $f2, $f2, $f1
180+
entry:
181+
%a0f0 = extractvalue {float, float} %a0, 0
182+
%a0f1 = extractvalue {float, float} %a0, 1
183+
%a1f0 = extractvalue {float, float} %a1, 0
184+
%a1f1 = extractvalue {float, float} %a1, 1
185+
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
186+
%max1 = tail call float @llvm.maximumnum.f32(float %a0f1, float %a1f1)
187+
%ret0 = insertvalue {float, float} poison, float %max0, 0
188+
%ret1 = insertvalue {float, float} %ret0, float %max1, 1
189+
ret {float, float} %ret1
152190
}
153191

154-
define %struct.f2 @mQ([2 x float] nofpclass(qnan) %a0, [2 x float] nofpclass(qnan) %a1) {
155-
; MIPS32R6-LABEL: mQ:
192+
define [2 x float] @mAQ([2 x float] nofpclass(qnan) %a0, [2 x float] nofpclass(qnan) %a1) {
193+
; MIPS32R6-LABEL: mAQ:
156194
; MIPS32R6: # %bb.0: # %entry
157195
; MIPS32R6-NEXT: min.s $f0, $f12, $f12
158196
; MIPS32R6-NEXT: mtc1 $6, $f1
@@ -164,7 +202,7 @@ define %struct.f2 @mQ([2 x float] nofpclass(qnan) %a0, [2 x float] nofpclass(qna
164202
; MIPS32R6-NEXT: jr $ra
165203
; MIPS32R6-NEXT: max.s $f2, $f1, $f2
166204
;
167-
; MIPS64R6-LABEL: mQ:
205+
; MIPS64R6-LABEL: mAQ:
168206
; MIPS64R6: # %bb.0: # %entry
169207
; MIPS64R6-NEXT: min.s $f0, $f14, $f14
170208
; MIPS64R6-NEXT: min.s $f1, $f12, $f12
@@ -180,7 +218,7 @@ entry:
180218
%a1f1 = extractvalue [2 x float] %a1, 1
181219
%max0 = tail call float @llvm.maximumnum.f32(float %a0f0, float %a1f0)
182220
%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
221+
%ret0 = insertvalue [2 x float] poison, float %max0, 0
222+
%ret1 = insertvalue [2 x float] %ret0, float %max1, 1
223+
ret [2 x float] %ret1
186224
}

0 commit comments

Comments
 (0)