[mlir][LLVM] Fix incorrect verification of atomicrmw f{min,max}imumnum (#190474)

Fix llvm.atomicrmw fminimumnum and fmaximumnum to correctly take the
float operation verification path.
This commit is contained in:
Ivan R. Ivanov 2026-04-04 19:17:37 +02:00 committed by GitHub
parent ff4c6fe24e
commit 420111e9e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -3663,7 +3663,9 @@ LogicalResult AtomicRMWOp::verify() {
if (getBinOp() == AtomicBinOp::fadd || getBinOp() == AtomicBinOp::fsub ||
getBinOp() == AtomicBinOp::fmin || getBinOp() == AtomicBinOp::fmax ||
getBinOp() == AtomicBinOp::fminimum ||
getBinOp() == AtomicBinOp::fmaximum) {
getBinOp() == AtomicBinOp::fmaximum ||
getBinOp() == AtomicBinOp::fminimumnum ||
getBinOp() == AtomicBinOp::fmaximumnum) {
if (isCompatibleVectorType(valType)) {
if (isScalableVectorType(valType))
return emitOpError("expected LLVM IR fixed vector type");

View File

@ -547,6 +547,8 @@ func.func @atomicrmw(%ptr : !llvm.ptr, %f32 : f32, %f16_vec : vector<2xf16>) {
%1 = llvm.atomicrmw volatile fsub %ptr, %f32 syncscope("singlethread") monotonic {alignment = 16 : i64} : !llvm.ptr, f32
// CHECK: llvm.atomicrmw fmin %{{.*}}, %{{.*}} monotonic : !llvm.ptr, vector<2xf16>
%2 = llvm.atomicrmw fmin %ptr, %f16_vec monotonic : !llvm.ptr, vector<2xf16>
// CHECK: llvm.atomicrmw fminimumnum %{{.*}}, %{{.*}} monotonic : !llvm.ptr, f32
%3 = llvm.atomicrmw fminimumnum %ptr, %f32 monotonic : !llvm.ptr, f32
llvm.return
}