File: GlobalISelEmitterMatchTableOptimizerSameOperand.td

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (26 lines) | stat: -rw-r--r-- 1,366 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// RUN: llvm-tblgen %s -gen-global-isel -optimize-match-table=true -I %p/../../include -I %p/Common -o - | FileCheck %s

include "llvm/Target/Target.td"
include "GlobalISelEmitterCommon.td"

def InstTwoOperands : I<(outs GPR32:$dst), (ins GPR32:$src1, GPR32:$src2), []>;
def InstThreeOperands : I<(outs GPR32:$dst), (ins GPR32:$cond, GPR32:$src,GPR32:$src2), []>;

// Make sure the GIM_CheckIsSameOperand check is not hoisted into the common header group

// CHECK:       GIM_Try, /*On fail goto*//*Label 1*/
// CHECK-NEXT:  GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/MyTarget::GPR32RegClassID,
// CHECK-NOT:   GIM_CheckIsSameOperand
// CHECK-NEXT:  GIM_Try, /*On fail goto*//*Label 2*/
// CHECK:       GIM_CheckIsSameOperand, /*MI*/0, /*OpIdx*/3, /*OtherMI*/2, /*OtherOpIdx*/1,
// CHECK:       // Label 2
// CHECK-NEXT:  GIM_Try, /*On fail goto*//*Label 3*/
// CHECK:       GIM_CheckIsSameOperand, /*MI*/0, /*OpIdx*/3, /*OtherMI*/2, /*OtherOpIdx*/2,
// CHECK:       // Label 1
def : Pat<(i32 (select GPR32:$cond, GPR32:$src1, GPR32:$src2)),
          (InstThreeOperands GPR32:$cond, GPR32:$src1, GPR32:$src2)>;

def : Pat<(i32 (select (i32 (setcc GPR32:$cond, (i32 0), (OtherVT SETEQ))),
                      (i32 (add GPR32:$src1, GPR32:$const)),
                       GPR32:$src1)),
          (InstThreeOperands GPR32:$cond, GPR32:$src1, GPR32:$const)>;