This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Code Cleanup Remove u1imm
AbandonedPublic

Authored by stefanp on Feb 5 2019, 9:05 AM.

Details

Summary

The type i1imm serves the same purpose as u1imm. Both types are not required.

This patch removes the u1imm type.

Diff Detail

Event Timeline

stefanp created this revision.Feb 5 2019, 9:05 AM
hfinkel accepted this revision.Feb 5 2019, 10:41 AM

LGTM. I suppose that I thought that this was needed at some point to parse (1, 0) instead of (-1, 0), but if this is not needed in practice, then it should be simplified.

This revision is now accepted and ready to land.Feb 5 2019, 10:41 AM

Hi Hal,
Thank you for the review.
I've looked around but the only place we use u1imm is where we only have 1 bit to use in the instruction anyway so we have no way to represent -1 anyway.

Hi Hal,
Thank you for the review.
I've looked around but the only place we use u1imm is where we only have 1 bit to use in the instruction anyway so we have no way to represent -1 anyway.

Okay. This is just a question of parsing and text formatting. A 1-bit signed number is -1 or 0, and an unsigned 1-bit number is 1 or 0.

stefanp abandoned this revision.Feb 5 2019, 3:57 PM

Hi Hal,
I'm actually not going to do this in the end.... I'm just going to abandon this patch.
I realized that we did actually need this type too.

The u1imm type is actually an i32 which is later restricted to be either a 0 or a 1. On the other hand the i1imm type is an i1. This is an important difference.

The issue is that some of the instructions that use this type have builtins. For example: vshasigmaw. The builtin requires that the single bit be passed in as a parameter and that means we need to use an i32. Anyway I'm going to leave the type in.