This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/GlobalISel: Legalize s33 G_ADD, G_SUB and G_MUL
AbandonedPublic

Authored by Petar.Avramovic on Jul 24 2020, 7:22 AM.

Details

Reviewers
foad
arsenm
Summary

Widen to next multiple of 32.
This can be later legalized using narrowScalar.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2020, 7:22 AM

I’ve been avoiding doing this since it’s really a workaround for narrowScalar not understanding what to do. Would it make more sense for narrow scalar to widen to the next multiple of 32 itself?

Would it make more sense for narrow scalar to widen to the next multiple of 32 itself?

Probably yes, at least for add, sub and mul. It could calculate required scalar size and call widenScalar instead on reporting UnableToLegalize.
I am not so sure if this would be correct in general, maybe some opcodes prefer next-power-of-2 instead of multiple of NarrowSize?

I’ve been avoiding doing this since it’s really a workaround for narrowScalar not understanding what to do. Would it make more sense for narrow scalar to widen to the next multiple of 32 itself?

Would it make more sense for narrow scalar to widen to the next multiple of 32 itself?

Probably yes, at least for add, sub and mul. It could calculate required scalar size and call widenScalar instead on reporting UnableToLegalize.
I am not so sure if this would be correct in general, maybe some opcodes prefer next-power-of-2 instead of multiple of NarrowSize?

This isn't a general property of widenScalar itself, but the add/sub/mul handling knows it can produce the requested size by widening, those implementations can be responsible for inserting an extend to the intermediate size it requires

arsenm resigned from this revision.Nov 16 2022, 3:57 PM

This works now, this can be abandoned

Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2022, 3:57 PM
Petar.Avramovic abandoned this revision.Nov 17 2022, 1:23 AM