44 lines · plain
1// RUN: llvm-tblgen -gen-dag-isel -I %p/../../include %s 2>&1 | FileCheck %s2// RUN: llvm-tblgen -gen-dag-isel -I %p/../../include -DIGNORE %s 2>&1 | FileCheck %s3 4include "llvm/Target/Target.td"5 6// Minimal Target definition7def DemoInstrInfo : InstrInfo;8def Demo : Target {9 let InstructionSet = DemoInstrInfo;10}11 12// Some registers which can hold ints or floats13foreach i = 0...7 in14 def "R" # i: Register<"r" # i>;15def GPR : RegisterClass<"Demo", [i32, f32], 32, (sequence "R%u", 0, 7)>;16 17// Instruction to convert an int to a float18def i2f : Instruction {19 let Size = 2;20 let OutOperandList = (outs GPR:$dst);21 let InOperandList = (ins GPR:$src);22 let AsmString = "i2f $dst, $src";23}24 25// Some kind of special type-conversion node supported by this target26def specialconvert : SDNode<"TEST_TARGET_ISD::SPECIAL_CONVERT", SDTUnaryOp>;27 28// A PatFrags that matches either bitconvert or the special version29def anyconvert : PatFrags<(ops node:$src),30 [(bitconvert node:$src),31 (specialconvert node:$src)]>;32 33#ifdef IGNORE34// Ensure ShouldIgnore does not disable records in dag isel emitter35let GISelShouldIgnore = 1 in36#endif37// And a rule that matches that PatFrag and turns it into i2f38def : Pat<(f32 (anyconvert (i32 GPR:$val))), (i2f GPR:$val)>;39 40// CHECK: SwitchOpcode{{.*}}ISD::BITCAST41// CHECK: MorphNodeTo1{{.*}}i2f42// CHECK: SwitchOpcode{{.*}}TEST_TARGET_ISD::SPECIAL_CONVERT43// CHECK: MorphNodeTo1{{.*}}i2f44