Misha Brukman | e07c2aa | 2004-02-25 21:02:21 +0000 | [diff] [blame] | 1 | //===- SparcV8Instrs.td - Target Description for SparcV8 Target -----------===// |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Misha Brukman | e07c2aa | 2004-02-25 21:02:21 +0000 | [diff] [blame] | 10 | // This file describes the SparcV8 instructions in TableGen format. |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Misha Brukman | e07c2aa | 2004-02-25 21:02:21 +0000 | [diff] [blame] | 14 | //===----------------------------------------------------------------------===// |
Misha Brukman | 23e6c1f | 2004-02-26 00:37:12 +0000 | [diff] [blame] | 15 | // Instruction format superclass |
Misha Brukman | e07c2aa | 2004-02-25 21:02:21 +0000 | [diff] [blame] | 16 | //===----------------------------------------------------------------------===// |
| 17 | |
| 18 | class InstV8 : Instruction { // SparcV8 instruction baseline |
| 19 | field bits<32> Inst; |
| 20 | |
| 21 | let Namespace = "V8"; |
| 22 | |
| 23 | bits<2> op; |
| 24 | let Inst{31-30} = op; // Top two bits are the 'op' field |
| 25 | |
| 26 | // Bit attributes specific to SparcV8 instructions |
| 27 | bit isPasi = 0; // Does this instruction affect an alternate addr space? |
| 28 | bit isPrivileged = 0; // Is this a privileged instruction? |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 29 | } |
| 30 | |
Chris Lattner | a85d46e | 2004-02-28 19:45:39 +0000 | [diff] [blame] | 31 | include "SparcV8InstrInfo_F2.td" |
| 32 | include "SparcV8InstrInfo_F3.td" |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 33 | |
Misha Brukman | 23e6c1f | 2004-02-26 00:37:12 +0000 | [diff] [blame] | 34 | //===----------------------------------------------------------------------===// |
| 35 | // Instructions |
| 36 | //===----------------------------------------------------------------------===// |
| 37 | |
Chris Lattner | 275f645 | 2004-02-28 19:37:18 +0000 | [diff] [blame] | 38 | // Pseudo instructions. |
| 39 | def PHI : InstV8 { |
| 40 | let Name = "PHI"; |
| 41 | } |
| 42 | def ADJCALLSTACKDOWN : InstV8 { |
| 43 | let Name = "ADJCALLSTACKDOWN"; |
| 44 | } |
| 45 | def ADJCALLSTACKUP : InstV8 { |
| 46 | let Name = "ADJCALLSTACKUP"; |
| 47 | } |
| 48 | |
Brian Gaeke | a8056fa | 2004-03-06 05:32:13 +0000 | [diff] [blame] | 49 | // Section A.3 - Synthetic Instructions, p. 85 |
| 50 | let isReturn = 1, isTerminator = 1, simm13 = 8 in |
| 51 | def RET : F3_2<2, 0b111000, "ret">; |
| 52 | let isReturn = 1, isTerminator = 1, simm13 = 8 in |
Brian Gaeke | 8542e08 | 2004-04-02 20:53:37 +0000 | [diff] [blame] | 53 | def RETL: F3_2<2, 0b111000, "retl">; |
| 54 | |
| 55 | // Section B.1 - Load Integer Instructions, p. 90 |
| 56 | def LDSBmr: F3_2<3, 0b001001, "ldsb">; |
| 57 | def LDSHmr: F3_2<3, 0b001010, "ldsh">; |
| 58 | def LDUBmr: F3_2<3, 0b000001, "ldub">; |
| 59 | def LDUHmr: F3_2<3, 0b000010, "lduh">; |
| 60 | def LDmr : F3_2<3, 0b000000, "ld">; |
| 61 | def LDDmr : F3_2<3, 0b000011, "ldd">; |
| 62 | |
| 63 | // Section B.4 - Store Integer Instructions, p. 95 |
| 64 | def STBrm : F3_2<3, 0b000101, "stb">; |
| 65 | def STHrm : F3_2<3, 0b000110, "sth">; |
| 66 | def STrm : F3_2<3, 0b000100, "st">; |
| 67 | def STDrm : F3_2<3, 0b000111, "std">; |
Misha Brukman | 23e6c1f | 2004-02-26 00:37:12 +0000 | [diff] [blame] | 68 | |
Brian Gaeke | 775158d | 2004-03-04 04:37:45 +0000 | [diff] [blame] | 69 | // Section B.9 - SETHI Instruction, p. 104 |
Brian Gaeke | e806173 | 2004-03-04 00:56:25 +0000 | [diff] [blame] | 70 | def SETHIi: F2_1<0b100, "sethi">; |
| 71 | |
Brian Gaeke | 8542e08 | 2004-04-02 20:53:37 +0000 | [diff] [blame] | 72 | // Section B.10 - NOP Instruction, p. 105 |
| 73 | // (It's a special case of SETHI) |
| 74 | let rd = 0, imm = 0 in |
| 75 | def NOP : F2_1<0b100, "nop">; |
| 76 | |
Brian Gaeke | bc1d27a | 2004-03-03 23:03:14 +0000 | [diff] [blame] | 77 | // Section B.11 - Logical Instructions, p. 106 |
| 78 | def ANDri : F3_2<2, 0b000001, "and">; |
| 79 | def ORrr : F3_1<2, 0b000010, "or">; |
Brian Gaeke | e806173 | 2004-03-04 00:56:25 +0000 | [diff] [blame] | 80 | def ORri : F3_2<2, 0b000010, "or">; |
Brian Gaeke | bc1d27a | 2004-03-03 23:03:14 +0000 | [diff] [blame] | 81 | |
| 82 | // Section B.12 - Shift Instructions, p. 107 |
| 83 | def SLLri : F3_1<2, 0b100101, "sll">; |
| 84 | def SRLri : F3_1<2, 0b100110, "srl">; |
| 85 | def SRAri : F3_1<2, 0b100111, "sra">; |
| 86 | |
| 87 | // Section B.13 - Add Instructions, p. 108 |
| 88 | def ADDrr : F3_1<2, 0b000000, "add">; |
| 89 | |
Brian Gaeke | 775158d | 2004-03-04 04:37:45 +0000 | [diff] [blame] | 90 | // Section B.15 - Subtract Instructions, p. 110 |
| 91 | def SUBrr : F3_1<2, 0b000100, "sub">; |
| 92 | |
Brian Gaeke | 032f80f | 2004-03-16 22:37:13 +0000 | [diff] [blame] | 93 | // Section B.18 - Multiply Instructions, p. 113 |
| 94 | def UMULrr : F3_1<2, 0b001010, "umul">; |
| 95 | def SMULrr : F3_1<2, 0b001011, "smul">; |
| 96 | |
Brian Gaeke | a8056fa | 2004-03-06 05:32:13 +0000 | [diff] [blame] | 97 | // Section B.20 - SAVE and RESTORE, p. 117 |
| 98 | def SAVErr : F3_1<2, 0b111100, "save">; // save r, r, r |
| 99 | def SAVEri : F3_2<2, 0b111100, "save">; // save r, i, r |
| 100 | def RESTORErr : F3_1<2, 0b111101, "restore">; // restore r, r, r |
| 101 | def RESTOREri : F3_2<2, 0b111101, "restore">; // restore r, i, r |
| 102 | |
Brian Gaeke | 8542e08 | 2004-04-02 20:53:37 +0000 | [diff] [blame] | 103 | // Section B.24 - Call and Link Instruction, p. 125 |
Brian Gaeke | a8056fa | 2004-03-06 05:32:13 +0000 | [diff] [blame] | 104 | // This is the only Format 1 instruction |
| 105 | def CALL : InstV8 { |
| 106 | bits<30> disp; |
| 107 | let op = 1; |
| 108 | let Inst{29-0} = disp; |
| 109 | let Name = "call"; |
| 110 | let isCall = 1; |
| 111 | } |
| 112 | |
Brian Gaeke | bc1d27a | 2004-03-03 23:03:14 +0000 | [diff] [blame] | 113 | // Section B.25 - Jump and Link, p. 126 |
Brian Gaeke | a8056fa | 2004-03-06 05:32:13 +0000 | [diff] [blame] | 114 | def JMPLrr : F3_1<2, 0b111000, "jmpl">; // jmpl [rs1+rs2], rd |
| 115 | def JMPLri : F3_2<2, 0b111000, "jmpl">; // jmpl [rs1+imm], rd |
Misha Brukman | 23e6c1f | 2004-02-26 00:37:12 +0000 | [diff] [blame] | 116 | |