1 // RUN: llvm-tblgen -gen-dag-isel -I %p/../../include %s 2>&1 | FileCheck %s
2 // RUN: llvm-tblgen -gen-dag-isel -I %p/../../include -DIGNORE %s 2>&1 | FileCheck %s
4 include "llvm/Target/Target.td"
6 // Minimal Target definition
7 def DemoInstrInfo : InstrInfo;
9 let InstructionSet = DemoInstrInfo;
12 // Some registers which can hold ints or floats
14 def "R" # i: Register<"r" # i>;
15 def GPR : RegisterClass<"Demo", [i32, f32], 32, (sequence "R%u", 0, 7)>;
17 // Instruction to convert an int to a float
18 def i2f : Instruction {
20 let OutOperandList = (outs GPR:$dst);
21 let InOperandList = (ins GPR:$src);
22 let AsmString = "i2f $dst, $src";
25 // Some kind of special type-conversion node supported by this target
26 def specialconvert : SDNode<"TEST_TARGET_ISD::SPECIAL_CONVERT", SDTUnaryOp>;
28 // A PatFrags that matches either bitconvert or the special version
29 def anyconvert : PatFrags<(ops node:$src),
30 [(bitconvert node:$src),
31 (specialconvert node:$src)]>;
34 // Ensure ShouldIgnore does not disable records in dag isel emitter
35 let GISelShouldIgnore = 1 in
37 // And a rule that matches that PatFrag and turns it into i2f
38 def : Pat<(f32 (anyconvert (i32 GPR:$val))), (i2f GPR:$val)>;
40 // CHECK: SwitchOpcode{{.*}}ISD::BITCAST
41 // CHECK: MorphNodeTo1{{.*}}i2f
42 // CHECK: SwitchOpcode{{.*}}TEST_TARGET_ISD::SPECIAL_CONVERT
43 // CHECK: MorphNodeTo1{{.*}}i2f