File: GlobalISelEmitterFlags.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 (60 lines) | stat: -rw-r--r-- 3,126 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// RUN: llvm-tblgen %s -gen-global-isel -optimize-match-table=false -I %p/../../include -I %p/Common -o - | FileCheck %s

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

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

class SrlPF<bit IC>: PatFrag<
  (ops node:$PATFRAG_Src0, node:$src1),
  (srl $PATFRAG_Src0, $src1)>, GISelFlags {
  let GIIgnoreCopies = IC;
}

// GIIgnoreCopies on Pattern
//  MIs[1] should be using IgnoreCopies variants.
let GIIgnoreCopies = 1 in
def : Pat<
  (i32 (sub (mul i32:$src0, i32:$src0), i32:$src1)),
  (InstThreeOperands GPR32:$src0, GPR32:$src1, GPR32:$src1)
>, GISelFlags;

// GIIgnoreCopies set on "root" PatFrag.
//  MIs[1] and MIs[2] should be using IgnoreCopies variants.
def : Pat<
  (i32 (SrlPF<1> (shl (mul i32:$src0, i32:$src0), i32:$src1), i32:$src0)),
  (InstThreeOperands GPR32:$src0, GPR32:$src1, GPR32:$src1)
>;

// GIIgnoreCopies set on "root" PatFrag, but a children PatFrag forces it back to zero.
//    MIs[1] should be using IgnoreCopies variants.
//    MIs[2] should NOT be using them.
def : Pat<
  (i32 (SrlPF<1> (SrlPF<0> (add i32:$src0, i32:$src0), i32:$src1), i32:$src0)),
  (InstThreeOperands GPR32:$src0, GPR32:$src1, GPR32:$src1)
>;

// CHECK: GIM_Try
// CHECK:    GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
// CHECK:    GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_LSHR
// CHECK:    GIM_RecordInsn, /*DefineMI*/2, /*MI*/1, /*OpIdx*/1, // MIs[2]
// CHECK:    GIM_CheckOpcode, /*MI*/2, TargetOpcode::G_ADD
// CHECK:    GIM_CheckIsSameOperand, /*MI*/2, /*OpIdx*/2, /*OtherMI*/2, /*OtherOpIdx*/1
// CHECK:    GIM_CheckIsSameOperandIgnoreCopies, /*MI*/0, /*OpIdx*/2, /*OtherMI*/2, /*OtherOpIdx*/1
// CHECK:    // (srl:{ *:[i32] } (srl:{ *:[i32] } (add:{ *:[i32] } i32:{ *:[i32] }:$src0, i32:{ *:[i32] }:$src0), i32:{ *:[i32] }:$src1), i32:{ *:[i32] }:$src0)
// CHECK:   GIR_Done
// CHECK: GIM_Try
// CHECK:   GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
// CHECK:   GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_SHL
// CHECK:   GIM_RecordInsnIgnoreCopies, /*DefineMI*/2, /*MI*/1, /*OpIdx*/1, // MIs[2]
// CHECK:   GIM_CheckOpcode, /*MI*/2, TargetOpcode::G_MUL
// CHECK:   GIM_CheckIsSameOperandIgnoreCopies, /*MI*/2, /*OpIdx*/2, /*OtherMI*/2, /*OtherOpIdx*/1
// CHECK:   GIM_CheckIsSameOperandIgnoreCopies, /*MI*/0, /*OpIdx*/2, /*OtherMI*/2, /*OtherOpIdx*/1
// CHECK:   // (srl:{ *:[i32] } (shl:{ *:[i32] } (mul:{ *:[i32] } i32:{ *:[i32] }:$src0, i32:{ *:[i32] }:$src0), i32:{ *:[i32] }:$src1), i32:{ *:[i32] }:$src0)
// CHECK:   GIR_Done
// CHECK: GIM_Try
// CHECK:   GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
// CHECK:   GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_MUL
// CHECK:   GIM_CheckIsSameOperandIgnoreCopies, /*MI*/1, /*OpIdx*/2, /*OtherMI*/1, /*OtherOpIdx*/1
// CHECK:   // (sub:{ *:[i32] } (mul:{ *:[i32] } i32:{ *:[i32] }:$src0, i32:{ *:[i32] }:$src0), i32:{ *:[i32] }:$src1)  =>  (InstThreeOperands:{ *:[i32] } GPR32:{ *:[i32] }:$src0, GPR32:{ *:[i32] }:$src1, GPR32:{ *:[i32] }:$src1)
// CHECK:   GIR_Done