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