1// WebAssemblyInstrInteger.td-WebAssembly Integer codegen -------*- tablegen -*- 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9/// 10/// \file 11/// \brief WebAssembly Integer operand code-gen constructs. 12/// 13//===----------------------------------------------------------------------===// 14 15defm ADD : BinaryInt<add>; 16defm SUB : BinaryInt<sub>; 17defm MUL : BinaryInt<mul>; 18defm SDIV : BinaryInt<sdiv>; 19defm UDIV : BinaryInt<udiv>; 20defm SREM : BinaryInt<srem>; 21defm UREM : BinaryInt<urem>; 22defm AND : BinaryInt<and>; 23defm IOR : BinaryInt<or>; 24defm XOR : BinaryInt<xor>; 25defm SHL : BinaryInt<shl>; 26defm SHR_U : BinaryInt<srl>; 27defm SHR_S : BinaryInt<sra>; 28 29defm EQ : ComparisonInt<SETEQ>; 30defm NE : ComparisonInt<SETNE>; 31defm SLT : ComparisonInt<SETLT>; 32defm SLE : ComparisonInt<SETLE>; 33defm ULT : ComparisonInt<SETULT>; 34defm ULE : ComparisonInt<SETULE>; 35defm SGT : ComparisonInt<SETGT>; 36defm SGE : ComparisonInt<SETGE>; 37defm UGT : ComparisonInt<SETUGT>; 38defm UGE : ComparisonInt<SETUGE>; 39 40defm CLZ : UnaryInt<ctlz>; 41defm CTZ : UnaryInt<cttz>; 42defm POPCNT : UnaryInt<ctpop>; 43 44// Expand the "don't care" operations to supported operations. 45def : Pat<(ctlz_zero_undef I32:$src), (CLZ_I32 I32:$src)>; 46def : Pat<(ctlz_zero_undef I64:$src), (CLZ_I64 I64:$src)>; 47def : Pat<(cttz_zero_undef I32:$src), (CTZ_I32 I32:$src)>; 48def : Pat<(cttz_zero_undef I64:$src), (CTZ_I64 I64:$src)>; 49