@@ -179,6 +179,7 @@ static constexpr IntrinsicHandler handlers[]{
179179 {{{" x" , asValue}, {" y" , asValue, handleDynamicOptional}}}},
180180 {" command_argument_count" , &I::genCommandArgumentCount},
181181 {" conjg" , &I::genConjg},
182+ {" cosd" , &I::genCosd},
182183 {" count" ,
183184 &I::genCount,
184185 {{{" mask" , asAddr}, {" dim" , asValue}, {" kind" , asValue}}},
@@ -550,6 +551,7 @@ static constexpr IntrinsicHandler handlers[]{
550551 {" shiftl" , &I::genShift<mlir::arith::ShLIOp>},
551552 {" shiftr" , &I::genShift<mlir::arith::ShRUIOp>},
552553 {" sign" , &I::genSign},
554+ {" sind" , &I::genSind},
553555 {" size" ,
554556 &I::genSize,
555557 {{{" array" , asBox},
@@ -2639,6 +2641,21 @@ mlir::Value IntrinsicLibrary::genConjg(mlir::Type resultType,
26392641 cplx, negImag, /* isImagPart=*/ true );
26402642}
26412643
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+
26422659// COUNT
26432660fir::ExtendedValue
26442661IntrinsicLibrary::genCount (mlir::Type resultType,
@@ -5593,6 +5610,21 @@ mlir::Value IntrinsicLibrary::genSign(mlir::Type resultType,
55935610 return genRuntimeCall (" sign" , resultType, args);
55945611}
55955612
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+
55965628// SIZE
55975629fir::ExtendedValue
55985630IntrinsicLibrary::genSize (mlir::Type resultType,
0 commit comments