This PR adds basic FPU support for the MIPS R5900 processor used in the PlayStation 2 Emotion Engine. The R5900 has a non-standard single-precision-only FPU with limited functionality compared to standard MIPS FPUs. Just like the previous r5900 PR, only existing instructions are used to implement basic support first. ## Changes ### Infrastructure for single-precision-only FPU (ce13ddea7bc7) - Add `isSingleFloat()` method to MipsAsmParser - Add `SINGLE` FpABIKind to MipsABIFlagsSection - Properly set CPR1Size and FpABI for single-float mode - Exclude double-precision PseudoCVT instructions when using single-float ### R5900 FPU support (13032c4d55b2) - Switch R5900 from soft-float to single-float mode - Implement R5900-specific FPU lowering with limited compare conditions - Use CVT.W.S instead of TRUNC.W.S for FP-to-int conversion (R5900 lacks TRUNC) - Add test coverage for R5900 FPU instructions and comparisons ### Invalidate unsupported FPU instructions (ee4222711dab) - Add predicates to exclude FPU instructions not supported by the R5900 - Add `C_COND_NOTR5900_M` multiclass for unsupported compare conditions - Add `ISA_MIPS2_NOT_R5900` predicate for ROUND/TRUNC/CEIL/FLOOR.W.S - Add test coverage for invalid R5900 FPU instructions ## R5900 FPU Limitations The R5900 FPU differs from standard MIPS FPUs in several ways: | Feature | Standard MIPS | R5900 | |---------|---------------|-------| | Precision | Single + Double | Single only | | Compare conditions | 16 | 4 (C.F, C.EQ, C.LT, C.LE) | | Rounding instructions | ROUND/TRUNC/CEIL/FLOOR.W.S | None (use CVT.W.S) | ## Test Plan - [x] Added `llvm/test/MC/Mips/r5900-fpu.s` - tests valid R5900 FPU instructions - [x] Added `llvm/test/MC/Mips/r5900-invalid.s` - tests rejection of unsupported instructions - [x] Added R5900 FPU comparison tests in `llvm/test/CodeGen/Mips/fcmp.ll`
The LLVM Compiler Infrastructure
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called "LLVM". This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Getting the Source Code and Building LLVM
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Getting in touch
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.