================ @@ -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 conversions are gone from the llvm output so at least there aren't no-op copies in the generated code. When/if clang emits mlir, any missing/broken unsigned optimizations will be more prominent and likely to get fixed for us. 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