diff options
| author | DaniPopes <57450786+DaniPopes@users.noreply.github.com> | 2024-12-06 23:16:06 +0100 |
|---|---|---|
| committer | DaniPopes <57450786+DaniPopes@users.noreply.github.com> | 2025-03-06 22:29:05 +0800 |
| commit | 58c10c66c1d5ec2e47e35a4ff31f3758448f20f4 (patch) | |
| tree | 0bb8c183d731a26c214bbd1b584b34c8cbaee6ff /compiler/rustc_codegen_ssa/src/traits/builder.rs | |
| parent | 002da76821d32c8807dc47da16660925d8cc9b62 (diff) | |
| download | rust-58c10c66c1d5ec2e47e35a4ff31f3758448f20f4.tar.gz rust-58c10c66c1d5ec2e47e35a4ff31f3758448f20f4.zip | |
Lower BinOp::Cmp to llvm.{s,u}cmp.* intrinsics
Lowers `mir::BinOp::Cmp` (`three_way_compare` intrinsic) to the corresponding
LLVM `llvm.{s,u}cmp.i8.*` intrinsics, added in LLVM 19.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/traits/builder.rs')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/traits/builder.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs index 99fd6b6510f..070b680e540 100644 --- a/compiler/rustc_codegen_ssa/src/traits/builder.rs +++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs @@ -397,6 +397,18 @@ pub trait BuilderMethods<'a, 'tcx>: fn icmp(&mut self, op: IntPredicate, lhs: Self::Value, rhs: Self::Value) -> Self::Value; fn fcmp(&mut self, op: RealPredicate, lhs: Self::Value, rhs: Self::Value) -> Self::Value; + /// Returns `-1` if `lhs < rhs`, `0` if `lhs == rhs`, and `1` if `lhs > rhs`. + // FIXME: Move the default implementation from `codegen_scalar_binop` into this method and + // remove the `Option` return once LLVM 20 is the minimum version. + fn three_way_compare( + &mut self, + _ty: Ty<'tcx>, + _lhs: Self::Value, + _rhs: Self::Value, + ) -> Option<Self::Value> { + None + } + fn memcpy( &mut self, dst: Self::Value, |
