xref: /llvm-project/llvm/lib/Target/Mips/MipsInstrCompiler.td (revision e13e95bc44b0f3cd4312078ecf98889888bc0511)
1*e13e95bcSyingopq//===- MipsInstrCompiler.td - Compiler Pseudos and Patterns -*- tablegen -*-===//
2*e13e95bcSyingopq//
3*e13e95bcSyingopq// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*e13e95bcSyingopq// See https://llvm.org/LICENSE.txt for license information.
5*e13e95bcSyingopq// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*e13e95bcSyingopq//
7*e13e95bcSyingopq//===----------------------------------------------------------------------===//
8*e13e95bcSyingopq//
9*e13e95bcSyingopq// This file describes the various pseudo instructions used by the compiler,
10*e13e95bcSyingopq// as well as Pat patterns used during instruction selection.
11*e13e95bcSyingopq//
12*e13e95bcSyingopq//===----------------------------------------------------------------------===//
13*e13e95bcSyingopq
14*e13e95bcSyingopq
15*e13e95bcSyingopqdef shiftMask_32 : PatFrag<(ops node:$lhs), (and node:$lhs, imm), [{
16*e13e95bcSyingopq  return isUnneededShiftMask(N, 5);
17*e13e95bcSyingopq}]>;
18*e13e95bcSyingopq
19*e13e95bcSyingopqdef shiftMask_64 : PatFrag<(ops node:$src0), (and node:$src0, imm), [{
20*e13e95bcSyingopq  return isUnneededShiftMask(N, 6);
21*e13e95bcSyingopq}]>;
22*e13e95bcSyingopq
23*e13e95bcSyingopqforeach width = [32, 64] in {
24*e13e95bcSyingopqdefvar shiftMask = !cast<SDPatternOperator>("shiftMask_"#width);
25*e13e95bcSyingopqdef mshl_#width : PatFrags<(ops node:$src0, node:$src1),
26*e13e95bcSyingopq  [(shl node:$src0, node:$src1), (shl node:$src0, (shiftMask node:$src1))]>;
27*e13e95bcSyingopq
28*e13e95bcSyingopqdef msrl_#width : PatFrags<(ops node:$src0, node:$src1),
29*e13e95bcSyingopq  [(srl node:$src0, node:$src1), (srl node:$src0, (shiftMask node:$src1))]>;
30*e13e95bcSyingopq
31*e13e95bcSyingopqdef msra_#width : PatFrags<(ops node:$src0, node:$src1),
32*e13e95bcSyingopq  [(sra node:$src0, node:$src1), (sra node:$src0, (shiftMask node:$src1))]>;
33*e13e95bcSyingopq}
34