1// WebAssemblyInstrExceptRef.td-WebAssembly except_ref 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/// WebAssembly except_ref operand code-gen constructs.
12///
13//===----------------------------------------------------------------------===//
14
15let Defs = [ARGUMENTS] in {
16
17defm SELECT_EXCEPT_REF : I<(outs EXCEPT_REF:$dst),
18                           (ins EXCEPT_REF:$lhs, EXCEPT_REF:$rhs, I32:$cond),
19                           (outs), (ins),
20                           [(set EXCEPT_REF:$dst,
21                            (select I32:$cond, EXCEPT_REF:$lhs,
22                             EXCEPT_REF:$rhs))],
23                           "except_ref.select\t$dst, $lhs, $rhs, $cond",
24                           "except_ref.select", 0x1b>;
25
26} // Defs = [ARGUMENTS]
27
28def : Pat<(select (i32 (setne I32:$cond, 0)), EXCEPT_REF:$lhs, EXCEPT_REF:$rhs),
29          (SELECT_EXCEPT_REF EXCEPT_REF:$lhs, EXCEPT_REF:$rhs, I32:$cond)>;
30def : Pat<(select (i32 (seteq I32:$cond, 0)), EXCEPT_REF:$lhs, EXCEPT_REF:$rhs),
31          (SELECT_EXCEPT_REF EXCEPT_REF:$rhs, EXCEPT_REF:$lhs, I32:$cond)>;
32