From: Philip Reames Date: Fri, 17 Jun 2022 17:40:48 +0000 (-0700) Subject: [riscv] Extract isMaskRegOp helper [nfc] X-Git-Tag: upstream/15.0.7~4343 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b595cddea7fe0f0b6b625e031852aa6a13194213;p=platform%2Fupstream%2Fllvm.git [riscv] Extract isMaskRegOp helper [nfc] --- diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp index f89f453..7fa0056 100644 --- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp +++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp @@ -303,6 +303,15 @@ static Optional getEEWForLoadStore(const MachineInstr &MI) { } } +static bool isMaskRegOp(const MachineInstr &MI) { + if (RISCVII::hasSEWOp(MI.getDesc().TSFlags)) { + const unsigned Log2SEW = MI.getOperand(getSEWOpNum(MI)).getImm(); + // A Log2SEW of 0 is an operation on mask registers only. + return Log2SEW == 0; + } + return false; +} + static unsigned getSEWLMULRatio(unsigned SEW, RISCVII::VLMUL VLMul) { unsigned LMul; bool Fractional; @@ -585,10 +594,7 @@ public: // FIXME: Mask reg operations are probably ok if "this" VLMAX is larger // than "Require". // FIXME: The policy bits can probably be ignored for mask reg operations. - const unsigned Log2SEW = MI.getOperand(getSEWOpNum(MI)).getImm(); - // A Log2SEW of 0 is an operation on mask registers only. - const bool MaskRegOp = Log2SEW == 0; - if (MaskRegOp && hasSameVLMAX(Require) && + if (isMaskRegOp(MI) && hasSameVLMAX(Require) && TailAgnostic == Require.TailAgnostic && MaskAgnostic == Require.MaskAgnostic) return true;