================ @@ -968,21 +968,41 @@ struct BinaryOp {}; fir::FirOpBuilder &builder, \ const Op &, hlfir::Entity lhs, \ hlfir::Entity rhs) { \ - return hlfir::EntityWithAttributes{ \ - builder.create<GenBinFirOp>(loc, lhs, rhs)}; \ + if constexpr (Fortran::common::TypeCategory::GenBinTyCat == \ + Fortran::common::TypeCategory::Unsigned && \ + !std::is_same_v<GenBinFirOp, mlir::arith::DivUIOp>) { \ + int bits = \ + Fortran::evaluate::Type<Fortran::common::TypeCategory::Integer, \ + KIND>::Scalar::bits; \ + auto signlessType = mlir::IntegerType::get( \ + builder.getContext(), bits, \ + mlir::IntegerType::SignednessSemantics::Signless); \ + auto lhsSL = builder.createConvert(loc, signlessType, lhs); \ ---------------- klausler wrote:
The conversion of the operands is required in order to avoid errors from the MLIR validator. The conversion of the result ensures that it is characterized properly as unsigned for any later use as an argument to a runtime intrinsic function or an output data transfer statement. https://github.com/llvm/llvm-project/pull/113504 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits