@@ -2648,16 +2648,18 @@ mlir::Value IntrinsicLibrary::genAbs(mlir::Type resultType,
2648
2648
// ACOSD
2649
2649
mlir::Value IntrinsicLibrary::genAcosd (mlir::Type resultType,
2650
2650
llvm::ArrayRef<mlir::Value> args) {
2651
+ // maps ACOSD to ACOS * 180 / pi
2651
2652
assert (args.size () == 1 );
2652
2653
mlir::MLIRContext *context = builder.getContext ();
2653
2654
mlir::FunctionType ftype =
2654
2655
mlir::FunctionType::get (context, {resultType}, {args[0 ].getType ()});
2656
+ mlir::Value result =
2657
+ getRuntimeCallGenerator (" acos" , ftype)(builder, loc, {args[0 ]});
2655
2658
llvm::APFloat pi = llvm::APFloat (llvm::numbers::pi);
2656
2659
mlir::Value dfactor = builder.createRealConstant (
2657
- loc, mlir::Float64Type::get (context), pi / llvm::APFloat (180.0 ));
2660
+ loc, mlir::Float64Type::get (context), llvm::APFloat (180.0 ) / pi );
2658
2661
mlir::Value factor = builder.createConvert (loc, args[0 ].getType (), dfactor);
2659
- mlir::Value arg = builder.create <mlir::arith::MulFOp>(loc, args[0 ], factor);
2660
- return getRuntimeCallGenerator (" acos" , ftype)(builder, loc, {arg});
2662
+ return builder.create <mlir::arith::MulFOp>(loc, result, factor);
2661
2663
}
2662
2664
2663
2665
// ADJUSTL & ADJUSTR
@@ -2799,16 +2801,18 @@ IntrinsicLibrary::genAny(mlir::Type resultType,
2799
2801
// ASIND
2800
2802
mlir::Value IntrinsicLibrary::genAsind (mlir::Type resultType,
2801
2803
llvm::ArrayRef<mlir::Value> args) {
2804
+ // maps ASIND to ASIN * 180 / pi
2802
2805
assert (args.size () == 1 );
2803
2806
mlir::MLIRContext *context = builder.getContext ();
2804
2807
mlir::FunctionType ftype =
2805
2808
mlir::FunctionType::get (context, {resultType}, {args[0 ].getType ()});
2809
+ mlir::Value result =
2810
+ getRuntimeCallGenerator (" asin" , ftype)(builder, loc, {args[0 ]});
2806
2811
llvm::APFloat pi = llvm::APFloat (llvm::numbers::pi);
2807
2812
mlir::Value dfactor = builder.createRealConstant (
2808
- loc, mlir::Float64Type::get (context), pi / llvm::APFloat (180.0 ));
2813
+ loc, mlir::Float64Type::get (context), llvm::APFloat (180.0 ) / pi );
2809
2814
mlir::Value factor = builder.createConvert (loc, args[0 ].getType (), dfactor);
2810
- mlir::Value arg = builder.create <mlir::arith::MulFOp>(loc, args[0 ], factor);
2811
- return getRuntimeCallGenerator (" asin" , ftype)(builder, loc, {arg});
2815
+ return builder.create <mlir::arith::MulFOp>(loc, result, factor);
2812
2816
}
2813
2817
2814
2818
// ATAND, ATAN2D
0 commit comments