Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR][Dialect] Extend BinaryFPToFPBuiltinOp to vector of FP type #1173

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions clang/include/clang/CIR/Dialect/IR/CIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -4425,8 +4425,9 @@ class BinaryFPToFPBuiltinOp<string mnemonic, string llvmOpName>
libc builtin equivalent ignoring floating-point exceptions and errno.
}];

let arguments = (ins CIR_AnyFloat:$lhs, CIR_AnyFloat:$rhs);
let results = (outs CIR_AnyFloat:$result);
let arguments = (ins CIR_AnyFloatOrVecOfFloat:$lhs,
CIR_AnyFloatOrVecOfFloat:$rhs);
let results = (outs CIR_AnyFloatOrVecOfFloat:$result);

let assemblyFormat = [{
$lhs `,` $rhs `:` qualified(type($lhs)) attr-dict
Expand Down
45 changes: 45 additions & 0 deletions clang/test/CIR/Lowering/builtin-floating-point.cir
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,51 @@ module {
%214 = cir.sqrt %arg2 : !cir.vector<!cir.float x 4>
// CHECK: llvm.intr.sqrt(%arg2) : (vector<4xf32>) -> vector<4xf32>

%15 = cir.copysign %arg0, %arg0 : !cir.float
// CHECK: llvm.intr.copysign(%arg0, %arg0) : (f32, f32) -> f32

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

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

%16 = cir.fmax %arg0, %arg0 : !cir.float
// CHECK: llvm.intr.maxnum(%arg0, %arg0) : (f32, f32) -> f32

%116 = cir.fmax %arg1, %arg1 : !cir.vector<!cir.double x 2>
// CHECK: llvm.intr.maxnum(%arg1, %arg1) : (vector<2xf64>, vector<2xf64>) -> vector<2xf64>

%216 = cir.fmax %arg2, %arg2 : !cir.vector<!cir.float x 4>
// CHECK: llvm.intr.maxnum(%arg2, %arg2) : (vector<4xf32>, vector<4xf32>) -> vector<4xf32>

%17 = cir.fmin %arg0, %arg0 : !cir.float
// CHECK: llvm.intr.minnum(%arg0, %arg0) : (f32, f32) -> f32

%117 = cir.fmin %arg1, %arg1 : !cir.vector<!cir.double x 2>
// CHECK: llvm.intr.minnum(%arg1, %arg1) : (vector<2xf64>, vector<2xf64>) -> vector<2xf64>

%217 = cir.fmin %arg2, %arg2 : !cir.vector<!cir.float x 4>
// CHECK: llvm.intr.minnum(%arg2, %arg2) : (vector<4xf32>, vector<4xf32>) -> vector<4xf32>

%18 = cir.fmod %arg0, %arg0 : !cir.float
// CHECK: llvm.frem %arg0, %arg0 : f32

%118 = cir.fmod %arg1, %arg1 : !cir.vector<!cir.double x 2>
// CHECK: llvm.frem %arg1, %arg1 : vector<2xf64>

%218 = cir.fmod %arg2, %arg2 : !cir.vector<!cir.float x 4>
// CHECK: llvm.frem %arg2, %arg2 : vector<4xf32>

%19 = cir.pow %arg0, %arg0 : !cir.float
// CHECK: llvm.intr.pow(%arg0, %arg0) : (f32, f32) -> f32

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

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

cir.return
}
}