Skip to content

Commit

Permalink
add FMaximumOp and FMinimumOp
Browse files Browse the repository at this point in the history
  • Loading branch information
ghehg committed Dec 17, 2024
1 parent 7e50d21 commit 27a1634
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/include/clang/CIR/Dialect/IR/CIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -4507,6 +4507,8 @@ class BinaryFPToFPBuiltinOp<string mnemonic, string llvmOpName>
def CopysignOp : BinaryFPToFPBuiltinOp<"copysign", "CopySignOp">;
def FMaxNumOp : BinaryFPToFPBuiltinOp<"fmaxnum", "MaxNumOp">;
def FMinNumOp : BinaryFPToFPBuiltinOp<"fminnum", "MinNumOp">;
def FMaximumOp : BinaryFPToFPBuiltinOp<"fmaximum", "MaximumOp">;
def FMinimumOp : BinaryFPToFPBuiltinOp<"fminimum", "MinimumOp">;
def FModOp : BinaryFPToFPBuiltinOp<"fmod", "FRemOp">;
def PowOp : BinaryFPToFPBuiltinOp<"pow", "PowOp">;

Expand Down
18 changes: 18 additions & 0 deletions clang/test/CIR/Lowering/builtin-floating-point.cir
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,24 @@ module {
%219 = cir.pow %arg2, %arg2 : !cir.vector<!cir.float x 4>
// CHECK: llvm.intr.pow(%arg2, %arg2) : (vector<4xf32>, vector<4xf32>) -> vector<4xf32>

%20 = cir.fmaximum %arg0, %arg0 : !cir.float
// CHECK: llvm.intr.maximum(%arg0, %arg0) : (f32, f32) -> f32

%120 = cir.fmaximum %arg1, %arg1 : !cir.vector<!cir.double x 2>
// CHECK: llvm.intr.maximum(%arg1, %arg1) : (vector<2xf64>, vector<2xf64>) -> vector<2xf64>

%220 = cir.fmaximum %arg2, %arg2 : !cir.vector<!cir.float x 4>
// CHECK: llvm.intr.maximum(%arg2, %arg2) : (vector<4xf32>, vector<4xf32>) -> vector<4xf32>

%21 = cir.fminimum %arg0, %arg0 : !cir.float
// CHECK: llvm.intr.minimum(%arg0, %arg0) : (f32, f32) -> f32

%121 = cir.fminimum %arg1, %arg1 : !cir.vector<!cir.double x 2>
// CHECK: llvm.intr.minimum(%arg1, %arg1) : (vector<2xf64>, vector<2xf64>) -> vector<2xf64>

%221 = cir.fminimum %arg2, %arg2 : !cir.vector<!cir.float x 4>
// CHECK: llvm.intr.minimum(%arg2, %arg2) : (vector<4xf32>, vector<4xf32>) -> vector<4xf32>

cir.return
}
}

0 comments on commit 27a1634

Please sign in to comment.