1*9880d681SAndroid Build Coastguard Worker// RUN: llvm-tblgen %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker// XFAIL: vg_leak 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker// CHECK: add_ps 5*9880d681SAndroid Build Coastguard Worker// CHECK: add_ps 6*9880d681SAndroid Build Coastguard Worker// CHECK: add_ps 7*9880d681SAndroid Build Coastguard Worker// CHECK-NOT: add_ps 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Workerclass ValueType<int size, int value> { 10*9880d681SAndroid Build Coastguard Worker int Size = size; 11*9880d681SAndroid Build Coastguard Worker int Value = value; 12*9880d681SAndroid Build Coastguard Worker} 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Workerdef v2i64 : ValueType<128, 22>; // 2 x i64 vector value 15*9880d681SAndroid Build Coastguard Workerdef v2f64 : ValueType<128, 28>; // 2 x f64 vector value 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Workerclass Intrinsic<string name> { 18*9880d681SAndroid Build Coastguard Worker string Name = name; 19*9880d681SAndroid Build Coastguard Worker} 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Workerclass Inst<bits<8> opcode, dag oopnds, dag iopnds, string asmstr, 22*9880d681SAndroid Build Coastguard Worker list<dag> pattern> { 23*9880d681SAndroid Build Coastguard Worker bits<8> Opcode = opcode; 24*9880d681SAndroid Build Coastguard Worker dag OutOperands = oopnds; 25*9880d681SAndroid Build Coastguard Worker dag InOperands = iopnds; 26*9880d681SAndroid Build Coastguard Worker string AssemblyString = asmstr; 27*9880d681SAndroid Build Coastguard Worker list<dag> Pattern = pattern; 28*9880d681SAndroid Build Coastguard Worker} 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Workerdef ops; 31*9880d681SAndroid Build Coastguard Workerdef outs; 32*9880d681SAndroid Build Coastguard Workerdef ins; 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Workerdef set; 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Worker// Define registers 37*9880d681SAndroid Build Coastguard Workerclass Register<string n> { 38*9880d681SAndroid Build Coastguard Worker string Name = n; 39*9880d681SAndroid Build Coastguard Worker} 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Workerclass RegisterClass<list<ValueType> regTypes, list<Register> regList> { 42*9880d681SAndroid Build Coastguard Worker list<ValueType> RegTypes = regTypes; 43*9880d681SAndroid Build Coastguard Worker list<Register> MemberList = regList; 44*9880d681SAndroid Build Coastguard Worker} 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Workerdef XMM0: Register<"xmm0">; 47*9880d681SAndroid Build Coastguard Workerdef XMM1: Register<"xmm1">; 48*9880d681SAndroid Build Coastguard Workerdef XMM2: Register<"xmm2">; 49*9880d681SAndroid Build Coastguard Workerdef XMM3: Register<"xmm3">; 50*9880d681SAndroid Build Coastguard Workerdef XMM4: Register<"xmm4">; 51*9880d681SAndroid Build Coastguard Workerdef XMM5: Register<"xmm5">; 52*9880d681SAndroid Build Coastguard Workerdef XMM6: Register<"xmm6">; 53*9880d681SAndroid Build Coastguard Workerdef XMM7: Register<"xmm7">; 54*9880d681SAndroid Build Coastguard Workerdef XMM8: Register<"xmm8">; 55*9880d681SAndroid Build Coastguard Workerdef XMM9: Register<"xmm9">; 56*9880d681SAndroid Build Coastguard Workerdef XMM10: Register<"xmm10">; 57*9880d681SAndroid Build Coastguard Workerdef XMM11: Register<"xmm11">; 58*9880d681SAndroid Build Coastguard Workerdef XMM12: Register<"xmm12">; 59*9880d681SAndroid Build Coastguard Workerdef XMM13: Register<"xmm13">; 60*9880d681SAndroid Build Coastguard Workerdef XMM14: Register<"xmm14">; 61*9880d681SAndroid Build Coastguard Workerdef XMM15: Register<"xmm15">; 62*9880d681SAndroid Build Coastguard Worker 63*9880d681SAndroid Build Coastguard Workerdef VR128 : RegisterClass<[v2i64, v2f64], 64*9880d681SAndroid Build Coastguard Worker [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, 65*9880d681SAndroid Build Coastguard Worker XMM8, XMM9, XMM10, XMM11, 66*9880d681SAndroid Build Coastguard Worker XMM12, XMM13, XMM14, XMM15]>; 67*9880d681SAndroid Build Coastguard Worker 68*9880d681SAndroid Build Coastguard Worker// Define intrinsics 69*9880d681SAndroid Build Coastguard Workerdef int_x86_sse2_add_ps : Intrinsic<"addps">; 70*9880d681SAndroid Build Coastguard Workerdef int_x86_sse2_add_pd : Intrinsic<"addpd">; 71*9880d681SAndroid Build Coastguard Worker 72*9880d681SAndroid Build Coastguard Workermulticlass arith<bits<8> opcode, string asmstr, string Intr> { 73*9880d681SAndroid Build Coastguard Worker def PS : Inst<opcode, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), 74*9880d681SAndroid Build Coastguard Worker !strconcat(asmstr, "\t$dst, $src1, $src2"), 75*9880d681SAndroid Build Coastguard Worker [(set VR128:$dst, (!cast<Intrinsic>(!strconcat(Intr, "_ps")) VR128:$src1, VR128:$src2))]>; 76*9880d681SAndroid Build Coastguard Worker 77*9880d681SAndroid Build Coastguard Worker def PD : Inst<opcode, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), 78*9880d681SAndroid Build Coastguard Worker !strconcat(asmstr, "\t$dst, $src1, $src2"), 79*9880d681SAndroid Build Coastguard Worker [(set VR128:$dst, (!cast<Intrinsic>(!strconcat(Intr, "_pd")) VR128:$src1, VR128:$src2))]>; 80*9880d681SAndroid Build Coastguard Worker} 81*9880d681SAndroid Build Coastguard Worker 82*9880d681SAndroid Build Coastguard Workerdefm ADD : arith<0x58, "add", "int_x86_sse2_add">; 83*9880d681SAndroid Build Coastguard Worker 84*9880d681SAndroid Build Coastguard Workerclass IntInst<bits<8> opcode, string asmstr, Intrinsic Intr> : 85*9880d681SAndroid Build Coastguard Worker Inst<opcode,(outs VR128:$dst), (ins VR128:$src1, VR128:$src2), 86*9880d681SAndroid Build Coastguard Worker !strconcat(asmstr, "\t$dst, $src1, $src2"), 87*9880d681SAndroid Build Coastguard Worker [(set VR128:$dst, (Intr VR128:$src1, VR128:$src2))]>; 88*9880d681SAndroid Build Coastguard Worker 89*9880d681SAndroid Build Coastguard Worker 90*9880d681SAndroid Build Coastguard Workermulticlass arith_int<bits<8> opcode, string asmstr, string Intr> { 91*9880d681SAndroid Build Coastguard Worker def PS_Int : IntInst<opcode, asmstr, !cast<Intrinsic>(!strconcat(Intr, "_ps"))>; 92*9880d681SAndroid Build Coastguard Worker 93*9880d681SAndroid Build Coastguard Worker def PD_Int : IntInst<opcode, asmstr, !cast<Intrinsic>(!strconcat(Intr, "_pd"))>; 94*9880d681SAndroid Build Coastguard Worker} 95*9880d681SAndroid Build Coastguard Worker 96*9880d681SAndroid Build Coastguard Workerdefm ADD : arith_int<0x58, "add", "int_x86_sse2_add">; 97