Commit 8d649fb
authored
[CIR][Dialect] Add FMaximumOp and FMinimumOp (#1237)
There are two sets of intrinsics regarding Min and Max operations for
floating points
[Maximum](https://mlir.llvm.org/docs/Dialects/LLVM/#llvmintrmaximum-llvmmaximumop)
vs
[Maxnum](https://mlir.llvm.org/docs/Dialects/LLVM/#llvmintrmaxnum-llvmmaxnumop)
[Minimum](https://mlir.llvm.org/docs/Dialects/LLVM/#llvmintrminimum-llvmminimumop)
vs
[Minnum](https://mlir.llvm.org/docs/Dialects/LLVM/#llvmintrminnum-llvmminnumop)
[The difference is whether NaN should be propagated when one of the
inputs is
NaN](https://llvm.org/docs/LangRef.html#llvm-maximumnum-intrinsic)
Maxnum and Minnum would return number if one of inputs is NaN, and the
other is a number,
But
Maximum and Minimum would return NaN (propagation of NaN)
And they are resolved to different ASM such as
[FMAX](https://developer.arm.com/documentation/ddi0596/2021-03/SIMD-FP-Instructions/FMAX--vector---Floating-point-Maximum--vector--?lang=en)
vs
[FMAXNM](https://developer.arm.com/documentation/ddi0596/2021-03/SIMD-FP-Instructions/FMAXNM--vector---Floating-point-Maximum-Number--vector--?lang=en)
Both have user cases, we already implemented Maxnum and Minnum
But Maximum and Minimum has user cases in [neon intrinsic
](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmax_f32
)
and [__builtin_elementwise_maximum
](https://github.com/llvm/clangir/blob/a989ecb2c55da1fe28e4072c31af025cba6c4f0f/clang/test/CodeGen/strictfp-elementwise-bulitins.cpp#L53)1 parent 49edd4b commit 8d649fb
File tree
4 files changed
+46
-26
lines changed- clang
- include/clang/CIR/Dialect/IR
- lib/CIR/CodeGen
- test/CIR
- CodeGen
- Lowering
4 files changed
+46
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4520 | 4520 | | |
4521 | 4521 | | |
4522 | 4522 | | |
4523 | | - | |
4524 | | - | |
| 4523 | + | |
| 4524 | + | |
| 4525 | + | |
| 4526 | + | |
4525 | 4527 | | |
4526 | 4528 | | |
4527 | 4529 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
670 | 670 | | |
671 | 671 | | |
672 | 672 | | |
673 | | - | |
| 673 | + | |
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
| |||
683 | 683 | | |
684 | 684 | | |
685 | 685 | | |
686 | | - | |
| 686 | + | |
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1300 | 1300 | | |
1301 | 1301 | | |
1302 | 1302 | | |
1303 | | - | |
| 1303 | + | |
1304 | 1304 | | |
1305 | 1305 | | |
1306 | 1306 | | |
| |||
1310 | 1310 | | |
1311 | 1311 | | |
1312 | 1312 | | |
1313 | | - | |
| 1313 | + | |
1314 | 1314 | | |
1315 | 1315 | | |
1316 | 1316 | | |
| |||
1320 | 1320 | | |
1321 | 1321 | | |
1322 | 1322 | | |
1323 | | - | |
1324 | | - | |
| 1323 | + | |
| 1324 | + | |
1325 | 1325 | | |
1326 | 1326 | | |
1327 | 1327 | | |
| |||
1335 | 1335 | | |
1336 | 1336 | | |
1337 | 1337 | | |
1338 | | - | |
| 1338 | + | |
1339 | 1339 | | |
1340 | 1340 | | |
1341 | 1341 | | |
| |||
1345 | 1345 | | |
1346 | 1346 | | |
1347 | 1347 | | |
1348 | | - | |
| 1348 | + | |
1349 | 1349 | | |
1350 | 1350 | | |
1351 | 1351 | | |
| |||
1355 | 1355 | | |
1356 | 1356 | | |
1357 | 1357 | | |
1358 | | - | |
1359 | | - | |
| 1358 | + | |
| 1359 | + | |
1360 | 1360 | | |
1361 | 1361 | | |
1362 | 1362 | | |
| |||
1368 | 1368 | | |
1369 | 1369 | | |
1370 | 1370 | | |
1371 | | - | |
| 1371 | + | |
1372 | 1372 | | |
1373 | 1373 | | |
1374 | 1374 | | |
| |||
1378 | 1378 | | |
1379 | 1379 | | |
1380 | 1380 | | |
1381 | | - | |
| 1381 | + | |
1382 | 1382 | | |
1383 | 1383 | | |
1384 | 1384 | | |
| |||
1388 | 1388 | | |
1389 | 1389 | | |
1390 | 1390 | | |
1391 | | - | |
1392 | | - | |
| 1391 | + | |
| 1392 | + | |
1393 | 1393 | | |
1394 | 1394 | | |
1395 | 1395 | | |
| |||
1403 | 1403 | | |
1404 | 1404 | | |
1405 | 1405 | | |
1406 | | - | |
| 1406 | + | |
1407 | 1407 | | |
1408 | 1408 | | |
1409 | 1409 | | |
| |||
1413 | 1413 | | |
1414 | 1414 | | |
1415 | 1415 | | |
1416 | | - | |
| 1416 | + | |
1417 | 1417 | | |
1418 | 1418 | | |
1419 | 1419 | | |
| |||
1423 | 1423 | | |
1424 | 1424 | | |
1425 | 1425 | | |
1426 | | - | |
1427 | | - | |
| 1426 | + | |
| 1427 | + | |
1428 | 1428 | | |
1429 | 1429 | | |
1430 | 1430 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
177 | 195 | | |
178 | 196 | | |
179 | 197 | | |
0 commit comments