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