@@ -179,6 +179,7 @@ static constexpr IntrinsicHandler handlers[]{
179
179
{{{" x" , asValue}, {" y" , asValue, handleDynamicOptional}}}},
180
180
{" command_argument_count" , &I::genCommandArgumentCount},
181
181
{" conjg" , &I::genConjg},
182
+ {" cosd" , &I::genCosd},
182
183
{" count" ,
183
184
&I::genCount,
184
185
{{{" mask" , asAddr}, {" dim" , asValue}, {" kind" , asValue}}},
@@ -550,6 +551,7 @@ static constexpr IntrinsicHandler handlers[]{
550
551
{" shiftl" , &I::genShift<mlir::arith::ShLIOp>},
551
552
{" shiftr" , &I::genShift<mlir::arith::ShRUIOp>},
552
553
{" sign" , &I::genSign},
554
+ {" sind" , &I::genSind},
553
555
{" size" ,
554
556
&I::genSize,
555
557
{{{" array" , asBox},
@@ -2639,6 +2641,21 @@ mlir::Value IntrinsicLibrary::genConjg(mlir::Type resultType,
2639
2641
cplx, negImag, /* isImagPart=*/ true );
2640
2642
}
2641
2643
2644
+ // COSD
2645
+ mlir::Value IntrinsicLibrary::genCosd (mlir::Type resultType,
2646
+ llvm::ArrayRef<mlir::Value> args) {
2647
+ assert (args.size () == 1 );
2648
+ mlir::MLIRContext *context = builder.getContext ();
2649
+ mlir::FunctionType ftype =
2650
+ mlir::FunctionType::get (context, {resultType}, {args[0 ].getType ()});
2651
+ llvm::APFloat pi = llvm::APFloat (llvm::numbers::pi);
2652
+ mlir::Value dfactor = builder.createRealConstant (
2653
+ loc, mlir::FloatType::getF64 (context), pi / llvm::APFloat (180.0 ));
2654
+ mlir::Value factor = builder.createConvert (loc, args[0 ].getType (), dfactor);
2655
+ mlir::Value arg = builder.create <mlir::arith::MulFOp>(loc, args[0 ], factor);
2656
+ return getRuntimeCallGenerator (" cos" , ftype)(builder, loc, {arg});
2657
+ }
2658
+
2642
2659
// COUNT
2643
2660
fir::ExtendedValue
2644
2661
IntrinsicLibrary::genCount (mlir::Type resultType,
@@ -5593,6 +5610,21 @@ mlir::Value IntrinsicLibrary::genSign(mlir::Type resultType,
5593
5610
return genRuntimeCall (" sign" , resultType, args);
5594
5611
}
5595
5612
5613
+ // SIND
5614
+ mlir::Value IntrinsicLibrary::genSind (mlir::Type resultType,
5615
+ llvm::ArrayRef<mlir::Value> args) {
5616
+ assert (args.size () == 1 );
5617
+ mlir::MLIRContext *context = builder.getContext ();
5618
+ mlir::FunctionType ftype =
5619
+ mlir::FunctionType::get (context, {resultType}, {args[0 ].getType ()});
5620
+ llvm::APFloat pi = llvm::APFloat (llvm::numbers::pi);
5621
+ mlir::Value dfactor = builder.createRealConstant (
5622
+ loc, mlir::FloatType::getF64 (context), pi / llvm::APFloat (180.0 ));
5623
+ mlir::Value factor = builder.createConvert (loc, args[0 ].getType (), dfactor);
5624
+ mlir::Value arg = builder.create <mlir::arith::MulFOp>(loc, args[0 ], factor);
5625
+ return getRuntimeCallGenerator (" sin" , ftype)(builder, loc, {arg});
5626
+ }
5627
+
5596
5628
// SIZE
5597
5629
fir::ExtendedValue
5598
5630
IntrinsicLibrary::genSize (mlir::Type resultType,
0 commit comments