Skip to content

Commit

Permalink
[PowerPC] comment for different input register classes; nfc
Browse files Browse the repository at this point in the history
Add comments to explain why XXPERMDIs and XXPERMDI have different input register
classes, vsfrc for XXPERMDIs and vsrc for XXPERMDI.

This addresses the comments in abandoned patch D113178, we keep using `f0` instead
of using `vs0` for XXPERMDIs on purpose.
  • Loading branch information
chenzheng1030 committed Nov 8, 2021
1 parent 4fb282f commit 7c6f595
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions llvm/lib/Target/PowerPC/PPCInstrVSX.td
Expand Up @@ -1066,6 +1066,14 @@ let hasSideEffects = 0 in {
[(set v2i64:$XT, (PPCxxpermdi v2i64:$XA, v2i64:$XB,
imm32SExt16:$DM))]>;
let isCodeGenOnly = 1 in
// Note that the input register class for `$XA` of XXPERMDIs is `vsfrc` which
// is not the same with the input register class(`vsrc`) of XXPERMDI instruction.
// We did this on purpose because:
// 1: The input is primarily for loads that load a partial vector(LFIWZX,
// etc.), no need for SUBREG_TO_REG.
// 2: With `vsfrc` register class, in the final assembly, float registers
// like `f0` are used instead of vector scalar register like `vs0`. This
// helps readability.
def XXPERMDIs : XX3Form_2s<60, 10, (outs vsrc:$XT), (ins vsfrc:$XA, u2imm:$DM),
"xxpermdi $XT, $XA, $XA, $DM", IIC_VecPerm, []>;
def XXSEL : XX4Form<60, 3,
Expand Down

0 comments on commit 7c6f595

Please sign in to comment.