JF Bastien | 5ca0bac | 2015-07-10 18:23:10 +0000 | [diff] [blame] | 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 | |
JF Bastien | d9767a3 | 2015-07-14 21:13:29 +0000 | [diff] [blame] | 15 | defm ADD : BinaryInt<add>; |
| 16 | defm SUB : BinaryInt<sub>; |
| 17 | defm MUL : BinaryInt<mul>; |
| 18 | defm SDIV : BinaryInt<sdiv>; |
| 19 | defm UDIV : BinaryInt<udiv>; |
| 20 | defm SREM : BinaryInt<srem>; |
| 21 | defm UREM : BinaryInt<urem>; |
| 22 | defm AND : BinaryInt<and>; |
| 23 | defm IOR : BinaryInt<or>; |
| 24 | defm XOR : BinaryInt<xor>; |
| 25 | defm SHL : BinaryInt<shl>; |
| 26 | defm SHR : BinaryInt<srl>; |
| 27 | defm SAR : BinaryInt<sra>; |
| 28 | |
JF Bastien | da06bce | 2015-08-11 21:02:46 +0000 | [diff] [blame] | 29 | defm EQ : ComparisonInt<SETEQ>; |
| 30 | defm NE : ComparisonInt<SETNE>; |
| 31 | defm SLT : ComparisonInt<SETLT>; |
| 32 | defm SLE : ComparisonInt<SETLE>; |
| 33 | defm ULT : ComparisonInt<SETULT>; |
| 34 | defm ULE : ComparisonInt<SETULE>; |
| 35 | defm SGT : ComparisonInt<SETGT>; |
| 36 | defm SGE : ComparisonInt<SETGE>; |
| 37 | defm UGT : ComparisonInt<SETUGT>; |
| 38 | defm UGE : ComparisonInt<SETUGE>; |
JF Bastien | d9767a3 | 2015-07-14 21:13:29 +0000 | [diff] [blame] | 39 | |
| 40 | defm CLZ : UnaryInt<ctlz>; |
| 41 | defm CTZ : UnaryInt<cttz>; |
| 42 | defm POPCNT : UnaryInt<ctpop>; |
Dan Gohman | 08fc966 | 2015-08-24 16:39:37 +0000 | [diff] [blame^] | 43 | |
| 44 | // Expand the "don't care" operations to supported operations. |
| 45 | def : Pat<(ctlz_zero_undef Int32:$src), (CLZ_I32 Int32:$src)>; |
| 46 | def : Pat<(ctlz_zero_undef Int64:$src), (CLZ_I64 Int64:$src)>; |
| 47 | def : Pat<(cttz_zero_undef Int32:$src), (CTZ_I32 Int32:$src)>; |
| 48 | def : Pat<(cttz_zero_undef Int64:$src), (CTZ_I64 Int64:$src)>; |