forked from OSchip/llvm-project
[mlir] Fix lowering of multi-dimensional vector log1p to LLVM
This was using the untransformed operand, leading to invalid IR. Differential Revision: https://reviews.llvm.org/D101531
This commit is contained in:
parent
16d707e656
commit
b389c80963
|
@ -2396,7 +2396,7 @@ struct Log1pOpLowering : public ConvertOpToLLVMPattern<math::Log1pOp> {
|
||||||
auto one =
|
auto one =
|
||||||
rewriter.create<LLVM::ConstantOp>(loc, llvm1DVectorTy, splatAttr);
|
rewriter.create<LLVM::ConstantOp>(loc, llvm1DVectorTy, splatAttr);
|
||||||
auto add = rewriter.create<LLVM::FAddOp>(loc, llvm1DVectorTy, one,
|
auto add = rewriter.create<LLVM::FAddOp>(loc, llvm1DVectorTy, one,
|
||||||
transformed.operand());
|
operands[0]);
|
||||||
return rewriter.create<LLVM::LogOp>(loc, llvm1DVectorTy, add);
|
return rewriter.create<LLVM::LogOp>(loc, llvm1DVectorTy, add);
|
||||||
},
|
},
|
||||||
rewriter);
|
rewriter);
|
||||||
|
|
|
@ -24,6 +24,19 @@ func @log1p(%arg0 : f32) {
|
||||||
|
|
||||||
// -----
|
// -----
|
||||||
|
|
||||||
|
// CHECK-LABEL: func @log1p_2dvector(
|
||||||
|
func @log1p_2dvector(%arg0 : vector<4x3xf32>) {
|
||||||
|
// CHECK: %[[EXTRACT:.*]] = llvm.extractvalue %arg0[0] : !llvm.array<4 x vector<3xf32>>
|
||||||
|
// CHECK: %[[ONE:.*]] = llvm.mlir.constant(dense<1.000000e+00> : vector<3xf32>) : vector<3xf32>
|
||||||
|
// CHECK: %[[ADD:.*]] = llvm.fadd %[[ONE]], %[[EXTRACT]] : vector<3xf32>
|
||||||
|
// CHECK: %[[LOG:.*]] = "llvm.intr.log"(%[[ADD]]) : (vector<3xf32>) -> vector<3xf32>
|
||||||
|
// CHECK: %[[INSERT:.*]] = llvm.insertvalue %[[LOG]], %0[0] : !llvm.array<4 x vector<3xf32>>
|
||||||
|
%0 = math.log1p %arg0 : vector<4x3xf32>
|
||||||
|
std.return
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
// CHECK-LABEL: func @rsqrt(
|
// CHECK-LABEL: func @rsqrt(
|
||||||
// CHECK-SAME: f32
|
// CHECK-SAME: f32
|
||||||
func @rsqrt(%arg0 : f32) {
|
func @rsqrt(%arg0 : f32) {
|
||||||
|
|
Loading…
Reference in New Issue