llvm-project
e9286131 - [LoongArch] Add tests for llvm.minimum/maximum lowering (#240280)

Commit
21 days ago
[LoongArch] Add tests for llvm.minimum/maximum lowering (#240280) Fixes #64208 Problem: LoongArch had no test for the NaN-propagating `llvm.minimum` / `llvm.maximum`; only the `*num` variants were covered by `fp-maximumnum-minimumnum.ll`. The soft-float configuration from the issue (`llc -mtriple=loongarch64 -mattr=-f,-d`) used to abort with ``` LLVM ERROR: Do not know how to soften the result of this operator! ``` That crash was fixed in the generic type legalizer, not in the LoongArch backend: #115463 added `SoftenFloatRes_{FMIN,FMAX}IMUM` and the `fminimum{f,,l}` / `fmaximum{f,,l}` libcalls, but only brought a RISCV test along. This patch adds the missing LoongArch coverage so the fix cannot regress silently. Tests: `llvm/test/CodeGen/LoongArch/fp-minimum-maximum.ll` covers f32/f64 with an FPU (LA32F/LA32D/LA64F/LA64D, the `fcmp.cun + fmin/fmax + fsel` expansion) and without one (LA32-SOFT/LA64-SOFT, the `fminimumf`/`fmaximumf` and `fminimum`/`fmaximum` libcalls). Removing the two `SoftenFloatResult` cases from #115463 reproduces the error above and makes the file fail; `llvm/test/CodeGen/LoongArch` passes (981 tests). AI tool use: this change was prepared with the assistance of Codex (deepseek-v4.1-flash) under the contributor's direction. The generated checks were read and validated by the contributor, who takes responsibility for the final patch.
Author
Parents
Loading