This is an archive of the discontinued LLVM Phabricator instance.

[NFC][compiler-rt] Factor out __mulv[sdt]i3 implementations to .inc file
ClosedPublic

Authored by atrosinenko on Aug 20 2020, 3:36 AM.

Details

Summary

The existing implementations are almost identical except for width of the integer type.

Factor them out to int_mulv_impl.inc for better maintainability.

The following command may help understanding the changes:

diff int_mulv_impl.inc \
     <(git show master:./mulvsi3.c | sed 's/si_int/fixint_t/g')

The si and di variants has three lines different (with two of them being comments) and ti has a bit larger diff.

Diff Detail

Event Timeline

atrosinenko created this revision.Aug 20 2020, 3:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 20 2020, 3:36 AM
Herald added subscribers: Restricted Project, dberris. · View Herald Transcript
atrosinenko requested review of this revision.Aug 20 2020, 3:36 AM
MaskRay added inline comments.Aug 20 2020, 4:10 PM
compiler-rt/lib/builtins/int_mulv_impl.inc
1

---*- C++ -*-===//

Explicitly mark .inc file as a C source like is already done for almost all *_impl.inc files.

atrosinenko added inline comments.Aug 21 2020, 7:40 AM
compiler-rt/lib/builtins/int_mulv_impl.inc
1

Thanks. It really is a C source (there are no C++ sources in the builtins library, as far as I know), still almost all other .inc files in this directory are actually marked with -*- C -*-, so explicitly marked this one as well.

Interestingly, int_div_impl.inc is the only one such file explicitly marked as C++, but it is probably a mistake.

MaskRay accepted this revision.Aug 21 2020, 8:58 AM

LGTM, but let's give others a chance to comment.

This revision is now accepted and ready to land.Aug 21 2020, 8:58 AM

Uploaded because it was already approved and no other review comments received since then. Anyway, please feel free to request followup changes if needed.