llvm.org GIT mirror llvm / cf1f644
assign stable opcodes to the various altivec ops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27741 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
1 changed file(s) with 34 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
101101 unsigned short OpNum;
102102 const char *Name;
103103
104 Operator(unsigned short shufflemask, const char *name)
105 : ShuffleMask(shufflemask), Name(name) {
106 OpNum = TheOperators.size();
104 Operator(unsigned short shufflemask, const char *name, unsigned opnum)
105 : ShuffleMask(shufflemask), OpNum(opnum), Name(name) {
107106 TheOperators.push_back(this);
108107 }
109108 ~Operator() {
437436 }
438437
439438
439 #define GENERATE_ALTIVEC
440
441 #ifdef GENERATE_ALTIVEC
440442
441443 ///===---------------------------------------------------------------------===//
442444 /// The altivec instruction definitions. This is the altivec-specific part of
443445 /// this file.
444446 ///===---------------------------------------------------------------------===//
445447
448 // Note that the opcode numbers here must match those in the PPC backend.
449 enum {
450 OP_COPY = 0, // Copy, used for things like to say it is <0,1,2,3>
451 OP_VMRGHW,
452 OP_VMRGLW,
453 OP_VSPLTISW0,
454 OP_VSPLTISW1,
455 OP_VSPLTISW2,
456 OP_VSPLTISW3,
457 OP_VSLDOI4,
458 OP_VSLDOI8,
459 OP_VSLDOI12,
460 };
461
446462 struct vmrghw : public Operator {
447 vmrghw() : Operator(0x0415, "vmrghw") {}
463 vmrghw() : Operator(0x0415, "vmrghw", OP_VMRGHW) {}
448464 } the_vmrghw;
449465
450466 struct vmrglw : public Operator {
451 vmrglw() : Operator(0x2637, "vmrglw") {}
467 vmrglw() : Operator(0x2637, "vmrglw", OP_VMRGLW) {}
452468 } the_vmrglw;
453469
454470 template
455471 struct vspltisw : public Operator {
456 vspltisw(const char *N) : Operator(MakeMask(Elt, Elt, Elt, Elt), N) {}
472 vspltisw(const char *N, unsigned Opc)
473 : Operator(MakeMask(Elt, Elt, Elt, Elt), N, Opc) {}
457474 };
458475
459 vspltisw<0> the_vspltisw0("vspltisw0");
460 vspltisw<1> the_vspltisw1("vspltisw1");
461 vspltisw<2> the_vspltisw2("vspltisw2");
462 vspltisw<3> the_vspltisw3("vspltisw3");
476 vspltisw<0> the_vspltisw0("vspltisw0", OP_VSPLTISW0);
477 vspltisw<1> the_vspltisw1("vspltisw1", OP_VSPLTISW1);
478 vspltisw<2> the_vspltisw2("vspltisw2", OP_VSPLTISW2);
479 vspltisw<3> the_vspltisw3("vspltisw3", OP_VSPLTISW3);
463480
464481 template
465482 struct vsldoi : public Operator {
466 vsldoi(const char *n) : Operator(MakeMask(N&7, (N+1)&7, (N+2)&7, (N+3)&7), n){
483 vsldoi(const char *Name, unsigned Opc)
484 : Operator(MakeMask(N&7, (N+1)&7, (N+2)&7, (N+3)&7), Name, Opc) {
467485 }
468486 };
469487
470 vsldoi<1> the_vsldoi1("vsldoi4");
471 vsldoi<2> the_vsldoi2("vsldoi8");
472 vsldoi<3> the_vsldoi3("vsldoi12");
473
488 vsldoi<1> the_vsldoi1("vsldoi4" , OP_VSLDOI4);
489 vsldoi<2> the_vsldoi2("vsldoi8" , OP_VSLDOI8);
490 vsldoi<3> the_vsldoi3("vsldoi12", OP_VSLDOI12);
491
492 #endif