Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- PPCInstr64Bit.td - The PowerPC 64-bit Support ------*- tablegen -*-===// |
| 2 | // |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 7 | // |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file describes the PowerPC 64-bit instructions. These patterns are used |
| 11 | // both when in ppc64 mode and when in "use 64-bit extensions in 32-bit" mode. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Chris Lattner | 2d4e8f7 | 2006-06-20 21:23:06 +0000 | [diff] [blame] | 15 | //===----------------------------------------------------------------------===// |
| 16 | // 64-bit operands. |
| 17 | // |
Chris Lattner | 7ecbd30 | 2006-06-26 23:53:10 +0000 | [diff] [blame] | 18 | def s16imm64 : Operand<i64> { |
| 19 | let PrintMethod = "printS16ImmOperand"; |
Ulrich Weigand | fd3ad69 | 2013-06-26 13:49:15 +0000 | [diff] [blame] | 20 | let EncoderMethod = "getImm16Encoding"; |
Ulrich Weigand | 640192d | 2013-05-03 19:49:39 +0000 | [diff] [blame] | 21 | let ParserMatchClass = PPCS16ImmAsmOperand; |
Chris Lattner | 7ecbd30 | 2006-06-26 23:53:10 +0000 | [diff] [blame] | 22 | } |
| 23 | def u16imm64 : Operand<i64> { |
| 24 | let PrintMethod = "printU16ImmOperand"; |
Ulrich Weigand | fd3ad69 | 2013-06-26 13:49:15 +0000 | [diff] [blame] | 25 | let EncoderMethod = "getImm16Encoding"; |
Ulrich Weigand | 640192d | 2013-05-03 19:49:39 +0000 | [diff] [blame] | 26 | let ParserMatchClass = PPCU16ImmAsmOperand; |
Chris Lattner | 7ecbd30 | 2006-06-26 23:53:10 +0000 | [diff] [blame] | 27 | } |
Ulrich Weigand | 5a02a02 | 2013-06-26 13:49:53 +0000 | [diff] [blame] | 28 | def s17imm64 : Operand<i64> { |
| 29 | // This operand type is used for addis/lis to allow the assembler parser |
| 30 | // to accept immediates in the range -65536..65535 for compatibility with |
| 31 | // the GNU assembler. The operand is treated as 16-bit otherwise. |
| 32 | let PrintMethod = "printS16ImmOperand"; |
| 33 | let EncoderMethod = "getImm16Encoding"; |
| 34 | let ParserMatchClass = PPCS17ImmAsmOperand; |
| 35 | } |
Hal Finkel | efe4a44 | 2012-09-05 19:22:27 +0000 | [diff] [blame] | 36 | def tocentry : Operand<iPTR> { |
Ulrich Weigand | fd24544 | 2013-03-19 19:50:30 +0000 | [diff] [blame] | 37 | let MIOperandInfo = (ops i64imm:$imm); |
Hal Finkel | efe4a44 | 2012-09-05 19:22:27 +0000 | [diff] [blame] | 38 | } |
Bill Schmidt | ca4a0c9 | 2012-12-04 16:18:08 +0000 | [diff] [blame] | 39 | def tlsreg : Operand<i64> { |
| 40 | let EncoderMethod = "getTLSRegEncoding"; |
| 41 | } |
Bill Schmidt | c56f1d3 | 2012-12-11 20:30:11 +0000 | [diff] [blame] | 42 | def tlsgd : Operand<i64> {} |
Ulrich Weigand | 5143bab | 2013-07-02 21:31:04 +0000 | [diff] [blame] | 43 | def tlscall : Operand<i64> { |
| 44 | let PrintMethod = "printTLSCall"; |
| 45 | let MIOperandInfo = (ops calltarget:$func, tlsgd:$sym); |
| 46 | let EncoderMethod = "getTLSCallEncoding"; |
| 47 | } |
Chris Lattner | 2d4e8f7 | 2006-06-20 21:23:06 +0000 | [diff] [blame] | 48 | |
Chris Lattner | 52a956d | 2006-06-20 23:18:58 +0000 | [diff] [blame] | 49 | //===----------------------------------------------------------------------===// |
| 50 | // 64-bit transformation functions. |
| 51 | // |
Chris Lattner | 2d4e8f7 | 2006-06-20 21:23:06 +0000 | [diff] [blame] | 52 | |
Chris Lattner | 52a956d | 2006-06-20 23:18:58 +0000 | [diff] [blame] | 53 | def SHL64 : SDNodeXForm<imm, [{ |
| 54 | // Transformation function: 63 - imm |
Dan Gohman | effb894 | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 55 | return getI32Imm(63 - N->getZExtValue()); |
Chris Lattner | 52a956d | 2006-06-20 23:18:58 +0000 | [diff] [blame] | 56 | }]>; |
| 57 | |
| 58 | def SRL64 : SDNodeXForm<imm, [{ |
| 59 | // Transformation function: 64 - imm |
Dan Gohman | effb894 | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 60 | return N->getZExtValue() ? getI32Imm(64 - N->getZExtValue()) : getI32Imm(0); |
Chris Lattner | 52a956d | 2006-06-20 23:18:58 +0000 | [diff] [blame] | 61 | }]>; |
| 62 | |
| 63 | def HI32_48 : SDNodeXForm<imm, [{ |
| 64 | // Transformation function: shift the immediate value down into the low bits. |
Dan Gohman | effb894 | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 65 | return getI32Imm((unsigned short)(N->getZExtValue() >> 32)); |
Chris Lattner | 52a956d | 2006-06-20 23:18:58 +0000 | [diff] [blame] | 66 | }]>; |
| 67 | |
| 68 | def HI48_64 : SDNodeXForm<imm, [{ |
| 69 | // Transformation function: shift the immediate value down into the low bits. |
Dan Gohman | effb894 | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 70 | return getI32Imm((unsigned short)(N->getZExtValue() >> 48)); |
Chris Lattner | 52a956d | 2006-06-20 23:18:58 +0000 | [diff] [blame] | 71 | }]>; |
Chris Lattner | 2d4e8f7 | 2006-06-20 21:23:06 +0000 | [diff] [blame] | 72 | |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 73 | |
| 74 | //===----------------------------------------------------------------------===// |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 75 | // Calls. |
| 76 | // |
| 77 | |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 78 | let Interpretation64Bit = 1 in { |
Ulrich Weigand | 410a40b | 2013-03-26 10:53:03 +0000 | [diff] [blame] | 79 | let isTerminator = 1, isBarrier = 1, PPC970_Unit = 7 in { |
Hal Finkel | 500b004 | 2013-04-10 06:42:34 +0000 | [diff] [blame] | 80 | let isBranch = 1, isIndirectBranch = 1, Uses = [CTR8] in { |
Ulrich Weigand | 410a40b | 2013-03-26 10:53:03 +0000 | [diff] [blame] | 81 | def BCTR8 : XLForm_2_ext<19, 528, 20, 0, 0, (outs), (ins), "bctr", BrB, []>, |
| 82 | Requires<[In64BitMode]>; |
Hal Finkel | 500b004 | 2013-04-10 06:42:34 +0000 | [diff] [blame] | 83 | |
Ulrich Weigand | d0585d8 | 2013-04-17 17:19:05 +0000 | [diff] [blame] | 84 | let isCodeGenOnly = 1 in |
Hal Finkel | 500b004 | 2013-04-10 06:42:34 +0000 | [diff] [blame] | 85 | def BCCTR8 : XLForm_2_br<19, 528, 0, (outs), (ins pred:$cond), |
Ulrich Weigand | 86247b6 | 2013-06-24 16:52:04 +0000 | [diff] [blame] | 86 | "b${cond:cc}ctr${cond:pm} ${cond:reg}", BrB, []>, |
Hal Finkel | 500b004 | 2013-04-10 06:42:34 +0000 | [diff] [blame] | 87 | Requires<[In64BitMode]>; |
| 88 | } |
Ulrich Weigand | 410a40b | 2013-03-26 10:53:03 +0000 | [diff] [blame] | 89 | } |
| 90 | |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 91 | let Defs = [LR8] in |
Will Schmidt | 4a67f2e | 2012-10-04 18:14:28 +0000 | [diff] [blame] | 92 | def MovePCtoLR8 : Pseudo<(outs), (ins), "#MovePCtoLR8", []>, |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 93 | PPC970_Unit_BRU; |
| 94 | |
Ulrich Weigand | 410a40b | 2013-03-26 10:53:03 +0000 | [diff] [blame] | 95 | let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7 in { |
| 96 | let Defs = [CTR8], Uses = [CTR8] in { |
| 97 | def BDZ8 : BForm_1<16, 18, 0, 0, (outs), (ins condbrtarget:$dst), |
| 98 | "bdz $dst">; |
| 99 | def BDNZ8 : BForm_1<16, 16, 0, 0, (outs), (ins condbrtarget:$dst), |
| 100 | "bdnz $dst">; |
| 101 | } |
Hal Finkel | 5711eca | 2013-04-09 22:58:37 +0000 | [diff] [blame] | 102 | |
| 103 | let isReturn = 1, Defs = [CTR8], Uses = [CTR8, LR8, RM] in { |
| 104 | def BDZLR8 : XLForm_2_ext<19, 16, 18, 0, 0, (outs), (ins), |
| 105 | "bdzlr", BrB, []>; |
| 106 | def BDNZLR8 : XLForm_2_ext<19, 16, 16, 0, 0, (outs), (ins), |
| 107 | "bdnzlr", BrB, []>; |
| 108 | } |
Ulrich Weigand | 410a40b | 2013-03-26 10:53:03 +0000 | [diff] [blame] | 109 | } |
| 110 | |
Hal Finkel | 5711eca | 2013-04-09 22:58:37 +0000 | [diff] [blame] | 111 | |
| 112 | |
Roman Divacky | ef21be2 | 2012-03-06 16:41:49 +0000 | [diff] [blame] | 113 | let isCall = 1, PPC970_Unit = 7, Defs = [LR8] in { |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 114 | // Convenient aliases for call instructions |
Dale Johannesen | 98aa9d3 | 2008-10-29 18:26:45 +0000 | [diff] [blame] | 115 | let Uses = [RM] in { |
Ulrich Weigand | f62e83f | 2013-03-22 15:24:13 +0000 | [diff] [blame] | 116 | def BL8 : IForm<18, 0, 1, (outs), (ins calltarget:$func), |
| 117 | "bl $func", BrB, []>; // See Pat patterns below. |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 118 | |
Ulrich Weigand | 42a09dc | 2013-07-02 21:31:59 +0000 | [diff] [blame] | 119 | def BL8_TLS : IForm<18, 0, 1, (outs), (ins tlscall:$func), |
| 120 | "bl $func", BrB, []>; |
| 121 | |
Ulrich Weigand | b6a30d1 | 2013-06-24 11:03:33 +0000 | [diff] [blame] | 122 | def BLA8 : IForm<18, 1, 1, (outs), (ins abscalltarget:$func), |
Ulrich Weigand | f62e83f | 2013-03-22 15:24:13 +0000 | [diff] [blame] | 123 | "bla $func", BrB, [(PPCcall (i64 imm:$func))]>; |
| 124 | } |
| 125 | let Uses = [RM], isCodeGenOnly = 1 in { |
| 126 | def BL8_NOP : IForm_and_DForm_4_zero<18, 0, 1, 24, |
Jakob Stoklund Olesen | ed6c040 | 2012-07-13 20:44:29 +0000 | [diff] [blame] | 127 | (outs), (ins calltarget:$func), |
Hal Finkel | 51861b4 | 2012-03-31 14:45:15 +0000 | [diff] [blame] | 128 | "bl $func\n\tnop", BrB, []>; |
| 129 | |
Ulrich Weigand | 5143bab | 2013-07-02 21:31:04 +0000 | [diff] [blame] | 130 | def BL8_NOP_TLS : IForm_and_DForm_4_zero<18, 0, 1, 24, |
| 131 | (outs), (ins tlscall:$func), |
| 132 | "bl $func\n\tnop", BrB, []>; |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 133 | |
Ulrich Weigand | f62e83f | 2013-03-22 15:24:13 +0000 | [diff] [blame] | 134 | def BLA8_NOP : IForm_and_DForm_4_zero<18, 1, 1, 24, |
Ulrich Weigand | b6a30d1 | 2013-06-24 11:03:33 +0000 | [diff] [blame] | 135 | (outs), (ins abscalltarget:$func), |
Hal Finkel | 51861b4 | 2012-03-31 14:45:15 +0000 | [diff] [blame] | 136 | "bla $func\n\tnop", BrB, |
Ulrich Weigand | f62e83f | 2013-03-22 15:24:13 +0000 | [diff] [blame] | 137 | [(PPCcall_nop (i64 imm:$func))]>; |
Dale Johannesen | 98aa9d3 | 2008-10-29 18:26:45 +0000 | [diff] [blame] | 138 | } |
Ulrich Weigand | f62e83f | 2013-03-22 15:24:13 +0000 | [diff] [blame] | 139 | let Uses = [CTR8, RM] in { |
| 140 | def BCTRL8 : XLForm_2_ext<19, 528, 20, 0, 1, (outs), (ins), |
| 141 | "bctrl", BrB, [(PPCbctrl)]>, |
| 142 | Requires<[In64BitMode]>; |
Ulrich Weigand | d0585d8 | 2013-04-17 17:19:05 +0000 | [diff] [blame] | 143 | |
| 144 | let isCodeGenOnly = 1 in |
Hal Finkel | 500b004 | 2013-04-10 06:42:34 +0000 | [diff] [blame] | 145 | def BCCTRL8 : XLForm_2_br<19, 528, 1, (outs), (ins pred:$cond), |
Ulrich Weigand | 86247b6 | 2013-06-24 16:52:04 +0000 | [diff] [blame] | 146 | "b${cond:cc}ctrl${cond:pm} ${cond:reg}", BrB, []>, |
Hal Finkel | 500b004 | 2013-04-10 06:42:34 +0000 | [diff] [blame] | 147 | Requires<[In64BitMode]>; |
Dale Johannesen | e395d78 | 2008-10-23 20:41:28 +0000 | [diff] [blame] | 148 | } |
Chris Lattner | 43df5b3 | 2007-02-25 05:34:32 +0000 | [diff] [blame] | 149 | } |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 150 | } // Interpretation64Bit |
Chris Lattner | 43df5b3 | 2007-02-25 05:34:32 +0000 | [diff] [blame] | 151 | |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 152 | // Calls |
Ulrich Weigand | f62e83f | 2013-03-22 15:24:13 +0000 | [diff] [blame] | 153 | def : Pat<(PPCcall (i64 tglobaladdr:$dst)), |
| 154 | (BL8 tglobaladdr:$dst)>; |
| 155 | def : Pat<(PPCcall_nop (i64 tglobaladdr:$dst)), |
| 156 | (BL8_NOP tglobaladdr:$dst)>; |
Nicolas Geoffray | 89d8187 | 2007-02-27 13:01:19 +0000 | [diff] [blame] | 157 | |
Ulrich Weigand | f62e83f | 2013-03-22 15:24:13 +0000 | [diff] [blame] | 158 | def : Pat<(PPCcall (i64 texternalsym:$dst)), |
| 159 | (BL8 texternalsym:$dst)>; |
| 160 | def : Pat<(PPCcall_nop (i64 texternalsym:$dst)), |
| 161 | (BL8_NOP texternalsym:$dst)>; |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 162 | |
Evan Cheng | 32e376f | 2008-07-12 02:23:19 +0000 | [diff] [blame] | 163 | // Atomic operations |
Dan Gohman | 453d64c | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 164 | let usesCustomInserter = 1 in { |
Jakob Stoklund Olesen | 86e1a65 | 2011-04-04 17:07:09 +0000 | [diff] [blame] | 165 | let Defs = [CR0] in { |
Evan Cheng | 32e376f | 2008-07-12 02:23:19 +0000 | [diff] [blame] | 166 | def ATOMIC_LOAD_ADD_I64 : Pseudo< |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 167 | (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_ADD_I64", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 168 | [(set i64:$dst, (atomic_load_add_64 xoaddr:$ptr, i64:$incr))]>; |
Dale Johannesen | d4eb052 | 2008-08-25 22:34:37 +0000 | [diff] [blame] | 169 | def ATOMIC_LOAD_SUB_I64 : Pseudo< |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 170 | (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_SUB_I64", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 171 | [(set i64:$dst, (atomic_load_sub_64 xoaddr:$ptr, i64:$incr))]>; |
Dale Johannesen | d4eb052 | 2008-08-25 22:34:37 +0000 | [diff] [blame] | 172 | def ATOMIC_LOAD_OR_I64 : Pseudo< |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 173 | (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_OR_I64", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 174 | [(set i64:$dst, (atomic_load_or_64 xoaddr:$ptr, i64:$incr))]>; |
Dale Johannesen | d4eb052 | 2008-08-25 22:34:37 +0000 | [diff] [blame] | 175 | def ATOMIC_LOAD_XOR_I64 : Pseudo< |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 176 | (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_XOR_I64", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 177 | [(set i64:$dst, (atomic_load_xor_64 xoaddr:$ptr, i64:$incr))]>; |
Dale Johannesen | d4eb052 | 2008-08-25 22:34:37 +0000 | [diff] [blame] | 178 | def ATOMIC_LOAD_AND_I64 : Pseudo< |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 179 | (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_AND_i64", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 180 | [(set i64:$dst, (atomic_load_and_64 xoaddr:$ptr, i64:$incr))]>; |
Dale Johannesen | d4eb052 | 2008-08-25 22:34:37 +0000 | [diff] [blame] | 181 | def ATOMIC_LOAD_NAND_I64 : Pseudo< |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 182 | (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$incr), "#ATOMIC_LOAD_NAND_I64", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 183 | [(set i64:$dst, (atomic_load_nand_64 xoaddr:$ptr, i64:$incr))]>; |
Dale Johannesen | d4eb052 | 2008-08-25 22:34:37 +0000 | [diff] [blame] | 184 | |
Dale Johannesen | dec5170 | 2008-08-22 03:49:10 +0000 | [diff] [blame] | 185 | def ATOMIC_CMP_SWAP_I64 : Pseudo< |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 186 | (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$old, g8rc:$new), "#ATOMIC_CMP_SWAP_I64", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 187 | [(set i64:$dst, (atomic_cmp_swap_64 xoaddr:$ptr, i64:$old, i64:$new))]>; |
Dale Johannesen | d4eb052 | 2008-08-25 22:34:37 +0000 | [diff] [blame] | 188 | |
Dale Johannesen | 765065c | 2008-08-25 21:09:52 +0000 | [diff] [blame] | 189 | def ATOMIC_SWAP_I64 : Pseudo< |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 190 | (outs g8rc:$dst), (ins memrr:$ptr, g8rc:$new), "#ATOMIC_SWAP_I64", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 191 | [(set i64:$dst, (atomic_swap_64 xoaddr:$ptr, i64:$new))]>; |
Dale Johannesen | dec5170 | 2008-08-22 03:49:10 +0000 | [diff] [blame] | 192 | } |
Evan Cheng | 5102bd9 | 2008-04-19 02:30:38 +0000 | [diff] [blame] | 193 | } |
| 194 | |
Evan Cheng | 32e376f | 2008-07-12 02:23:19 +0000 | [diff] [blame] | 195 | // Instructions to support atomic operations |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 196 | def LDARX : XForm_1<31, 84, (outs g8rc:$rD), (ins memrr:$ptr), |
Evan Cheng | 32e376f | 2008-07-12 02:23:19 +0000 | [diff] [blame] | 197 | "ldarx $rD, $ptr", LdStLDARX, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 198 | [(set i64:$rD, (PPClarx xoaddr:$ptr))]>; |
Evan Cheng | 32e376f | 2008-07-12 02:23:19 +0000 | [diff] [blame] | 199 | |
| 200 | let Defs = [CR0] in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 201 | def STDCX : XForm_1<31, 214, (outs), (ins g8rc:$rS, memrr:$dst), |
Evan Cheng | 32e376f | 2008-07-12 02:23:19 +0000 | [diff] [blame] | 202 | "stdcx. $rS, $dst", LdStSTDCX, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 203 | [(PPCstcx i64:$rS, xoaddr:$dst)]>, |
Evan Cheng | 32e376f | 2008-07-12 02:23:19 +0000 | [diff] [blame] | 204 | isDOT; |
| 205 | |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 206 | let Interpretation64Bit = 1 in { |
Dale Johannesen | 98aa9d3 | 2008-10-29 18:26:45 +0000 | [diff] [blame] | 207 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in |
Arnold Schwaighofer | be0de34 | 2008-04-30 09:16:33 +0000 | [diff] [blame] | 208 | def TCRETURNdi8 :Pseudo< (outs), |
Jakob Stoklund Olesen | ed6c040 | 2012-07-13 20:44:29 +0000 | [diff] [blame] | 209 | (ins calltarget:$dst, i32imm:$offset), |
Arnold Schwaighofer | be0de34 | 2008-04-30 09:16:33 +0000 | [diff] [blame] | 210 | "#TC_RETURNd8 $dst $offset", |
| 211 | []>; |
| 212 | |
Dale Johannesen | 98aa9d3 | 2008-10-29 18:26:45 +0000 | [diff] [blame] | 213 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in |
Ulrich Weigand | b6a30d1 | 2013-06-24 11:03:33 +0000 | [diff] [blame] | 214 | def TCRETURNai8 :Pseudo<(outs), (ins abscalltarget:$func, i32imm:$offset), |
Arnold Schwaighofer | be0de34 | 2008-04-30 09:16:33 +0000 | [diff] [blame] | 215 | "#TC_RETURNa8 $func $offset", |
| 216 | [(PPCtc_return (i64 imm:$func), imm:$offset)]>; |
| 217 | |
Dale Johannesen | 98aa9d3 | 2008-10-29 18:26:45 +0000 | [diff] [blame] | 218 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in |
Jakob Stoklund Olesen | ed6c040 | 2012-07-13 20:44:29 +0000 | [diff] [blame] | 219 | def TCRETURNri8 : Pseudo<(outs), (ins CTRRC8:$dst, i32imm:$offset), |
Arnold Schwaighofer | be0de34 | 2008-04-30 09:16:33 +0000 | [diff] [blame] | 220 | "#TC_RETURNr8 $dst $offset", |
| 221 | []>; |
| 222 | |
Ulrich Weigand | bbfb0c5 | 2013-03-26 10:57:16 +0000 | [diff] [blame] | 223 | let isCodeGenOnly = 1 in { |
Arnold Schwaighofer | be0de34 | 2008-04-30 09:16:33 +0000 | [diff] [blame] | 224 | |
| 225 | let isTerminator = 1, isBarrier = 1, PPC970_Unit = 7, isBranch = 1, |
Ulrich Weigand | 410a40b | 2013-03-26 10:53:03 +0000 | [diff] [blame] | 226 | isIndirectBranch = 1, isCall = 1, isReturn = 1, Uses = [CTR8, RM] in |
| 227 | def TAILBCTR8 : XLForm_2_ext<19, 528, 20, 0, 0, (outs), (ins), "bctr", BrB, []>, |
| 228 | Requires<[In64BitMode]>; |
Arnold Schwaighofer | be0de34 | 2008-04-30 09:16:33 +0000 | [diff] [blame] | 229 | |
| 230 | |
| 231 | let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7, |
Dale Johannesen | 98aa9d3 | 2008-10-29 18:26:45 +0000 | [diff] [blame] | 232 | isBarrier = 1, isCall = 1, isReturn = 1, Uses = [RM] in |
Arnold Schwaighofer | be0de34 | 2008-04-30 09:16:33 +0000 | [diff] [blame] | 233 | def TAILB8 : IForm<18, 0, 0, (outs), (ins calltarget:$dst), |
| 234 | "b $dst", BrB, |
| 235 | []>; |
| 236 | |
| 237 | |
| 238 | let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7, |
Dale Johannesen | 98aa9d3 | 2008-10-29 18:26:45 +0000 | [diff] [blame] | 239 | isBarrier = 1, isCall = 1, isReturn = 1, Uses = [RM] in |
Ulrich Weigand | b6a30d1 | 2013-06-24 11:03:33 +0000 | [diff] [blame] | 240 | def TAILBA8 : IForm<18, 0, 0, (outs), (ins abscalltarget:$dst), |
Arnold Schwaighofer | be0de34 | 2008-04-30 09:16:33 +0000 | [diff] [blame] | 241 | "ba $dst", BrB, |
| 242 | []>; |
| 243 | |
Ulrich Weigand | bbfb0c5 | 2013-03-26 10:57:16 +0000 | [diff] [blame] | 244 | } |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 245 | } // Interpretation64Bit |
Ulrich Weigand | bbfb0c5 | 2013-03-26 10:57:16 +0000 | [diff] [blame] | 246 | |
Arnold Schwaighofer | be0de34 | 2008-04-30 09:16:33 +0000 | [diff] [blame] | 247 | def : Pat<(PPCtc_return (i64 tglobaladdr:$dst), imm:$imm), |
| 248 | (TCRETURNdi8 tglobaladdr:$dst, imm:$imm)>; |
| 249 | |
| 250 | def : Pat<(PPCtc_return (i64 texternalsym:$dst), imm:$imm), |
| 251 | (TCRETURNdi8 texternalsym:$dst, imm:$imm)>; |
| 252 | |
| 253 | def : Pat<(PPCtc_return CTRRC8:$dst, imm:$imm), |
| 254 | (TCRETURNri8 CTRRC8:$dst, imm:$imm)>; |
| 255 | |
Hal Finkel | 96c2d4d | 2012-06-08 15:38:21 +0000 | [diff] [blame] | 256 | |
Hal Finkel | 25aab01 | 2013-03-28 03:38:08 +0000 | [diff] [blame] | 257 | // 64-bit CR instructions |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 258 | let Interpretation64Bit = 1 in { |
Hal Finkel | b47a69a | 2013-04-07 14:33:13 +0000 | [diff] [blame] | 259 | let neverHasSideEffects = 1 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 260 | def MTCRF8 : XFXForm_5<31, 144, (outs crbitm:$FXM), (ins g8rc:$rS), |
Hal Finkel | ac9df3d | 2011-12-07 06:34:06 +0000 | [diff] [blame] | 261 | "mtcrf $FXM, $rS", BrMCRX>, |
| 262 | PPC970_MicroCode, PPC970_Unit_CRU; |
| 263 | |
Ulrich Weigand | bbfb0c5 | 2013-03-26 10:57:16 +0000 | [diff] [blame] | 264 | let isCodeGenOnly = 1 in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 265 | def MFCR8pseud: XFXForm_3<31, 19, (outs g8rc:$rT), (ins crbitm:$FXM), |
Will Schmidt | 4a67f2e | 2012-10-04 18:14:28 +0000 | [diff] [blame] | 266 | "#MFCR8pseud", SprMFCR>, |
Hal Finkel | ac9df3d | 2011-12-07 06:34:06 +0000 | [diff] [blame] | 267 | PPC970_MicroCode, PPC970_Unit_CRU; |
Hal Finkel | b47a69a | 2013-04-07 14:33:13 +0000 | [diff] [blame] | 268 | } // neverHasSideEffects = 1 |
| 269 | |
Hal Finkel | 2f29391 | 2013-04-13 23:06:15 +0000 | [diff] [blame] | 270 | let neverHasSideEffects = 1 in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 271 | def MFCR8 : XFXForm_3<31, 19, (outs g8rc:$rT), (ins), |
Hal Finkel | ac9df3d | 2011-12-07 06:34:06 +0000 | [diff] [blame] | 272 | "mfcr $rT", SprMFCR>, |
| 273 | PPC970_MicroCode, PPC970_Unit_CRU; |
Arnold Schwaighofer | be0de34 | 2008-04-30 09:16:33 +0000 | [diff] [blame] | 274 | |
Ulrich Weigand | bbfb0c5 | 2013-03-26 10:57:16 +0000 | [diff] [blame] | 275 | let hasSideEffects = 1, isBarrier = 1, usesCustomInserter = 1 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 276 | def EH_SjLj_SetJmp64 : Pseudo<(outs gprc:$dst), (ins memr:$buf), |
Hal Finkel | 756810f | 2013-03-21 21:37:52 +0000 | [diff] [blame] | 277 | "#EH_SJLJ_SETJMP64", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 278 | [(set i32:$dst, (PPCeh_sjlj_setjmp addr:$buf))]>, |
Hal Finkel | 756810f | 2013-03-21 21:37:52 +0000 | [diff] [blame] | 279 | Requires<[In64BitMode]>; |
| 280 | let isTerminator = 1 in |
| 281 | def EH_SjLj_LongJmp64 : Pseudo<(outs), (ins memr:$buf), |
| 282 | "#EH_SJLJ_LONGJMP64", |
| 283 | [(PPCeh_sjlj_longjmp addr:$buf)]>, |
| 284 | Requires<[In64BitMode]>; |
| 285 | } |
| 286 | |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 287 | //===----------------------------------------------------------------------===// |
| 288 | // 64-bit SPR manipulation instrs. |
| 289 | |
Dale Johannesen | e395d78 | 2008-10-23 20:41:28 +0000 | [diff] [blame] | 290 | let Uses = [CTR8] in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 291 | def MFCTR8 : XFXForm_1_ext<31, 339, 9, (outs g8rc:$rT), (ins), |
Evan Cheng | 94b5a80 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 292 | "mfctr $rT", SprMFSPR>, |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 293 | PPC970_DGroup_First, PPC970_Unit_FXU; |
Dale Johannesen | e395d78 | 2008-10-23 20:41:28 +0000 | [diff] [blame] | 294 | } |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 295 | let Pattern = [(PPCmtctr i64:$rS)], Defs = [CTR8] in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 296 | def MTCTR8 : XFXForm_7_ext<31, 467, 9, (outs), (ins g8rc:$rS), |
Evan Cheng | 94b5a80 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 297 | "mtctr $rS", SprMTSPR>, |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 298 | PPC970_DGroup_First, PPC970_Unit_FXU; |
Chris Lattner | 3b58734 | 2006-06-27 18:36:44 +0000 | [diff] [blame] | 299 | } |
Hal Finkel | 25c1992 | 2013-05-15 21:37:41 +0000 | [diff] [blame] | 300 | let hasSideEffects = 1, isCodeGenOnly = 1, Defs = [CTR8] in { |
| 301 | let Pattern = [(int_ppc_mtctr i64:$rS)] in |
Hal Finkel | 0859ef2 | 2013-05-20 16:08:37 +0000 | [diff] [blame] | 302 | def MTCTR8loop : XFXForm_7_ext<31, 467, 9, (outs), (ins g8rc:$rS), |
| 303 | "mtctr $rS", SprMTSPR>, |
| 304 | PPC970_DGroup_First, PPC970_Unit_FXU; |
Hal Finkel | 25c1992 | 2013-05-15 21:37:41 +0000 | [diff] [blame] | 305 | } |
Chris Lattner | d48ce27 | 2006-06-27 18:18:41 +0000 | [diff] [blame] | 306 | |
Ulrich Weigand | ae9cf58 | 2013-07-03 12:32:41 +0000 | [diff] [blame^] | 307 | let isCodeGenOnly = 1, Pattern = [(set i64:$rT, readcyclecounter)] in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 308 | def MFTB8 : XFXForm_1_ext<31, 339, 268, (outs g8rc:$rT), (ins), |
Hal Finkel | 33e529d | 2012-08-06 21:21:44 +0000 | [diff] [blame] | 309 | "mfspr $rT, 268", SprMFTB>, |
Hal Finkel | 70381a7 | 2012-08-04 14:10:46 +0000 | [diff] [blame] | 310 | PPC970_DGroup_First, PPC970_Unit_FXU; |
Hal Finkel | 895a5f5 | 2012-08-07 17:04:20 +0000 | [diff] [blame] | 311 | // Note that encoding mftb using mfspr is now the preferred form, |
| 312 | // and has been since at least ISA v2.03. The mftb instruction has |
| 313 | // now been phased out. Using mfspr, however, is known not to work on |
| 314 | // the POWER3. |
Hal Finkel | 70381a7 | 2012-08-04 14:10:46 +0000 | [diff] [blame] | 315 | |
Evan Cheng | 3e18e50 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 316 | let Defs = [X1], Uses = [X1] in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 317 | def DYNALLOC8 : Pseudo<(outs g8rc:$result), (ins g8rc:$negsize, memri:$fpsi),"#DYNALLOC8", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 318 | [(set i64:$result, |
| 319 | (PPCdynalloc i64:$negsize, iaddr:$fpsi))]>; |
Jim Laskey | 48850c1 | 2006-11-16 22:43:37 +0000 | [diff] [blame] | 320 | |
Dale Johannesen | e395d78 | 2008-10-23 20:41:28 +0000 | [diff] [blame] | 321 | let Defs = [LR8] in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 322 | def MTLR8 : XFXForm_7_ext<31, 467, 8, (outs), (ins g8rc:$rS), |
Evan Cheng | 94b5a80 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 323 | "mtlr $rS", SprMTSPR>, |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 324 | PPC970_DGroup_First, PPC970_Unit_FXU; |
Dale Johannesen | e395d78 | 2008-10-23 20:41:28 +0000 | [diff] [blame] | 325 | } |
| 326 | let Uses = [LR8] in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 327 | def MFLR8 : XFXForm_1_ext<31, 339, 8, (outs g8rc:$rT), (ins), |
Evan Cheng | 94b5a80 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 328 | "mflr $rT", SprMFSPR>, |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 329 | PPC970_DGroup_First, PPC970_Unit_FXU; |
Dale Johannesen | e395d78 | 2008-10-23 20:41:28 +0000 | [diff] [blame] | 330 | } |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 331 | } // Interpretation64Bit |
Chris Lattner | 44dbdbe | 2006-11-14 18:44:47 +0000 | [diff] [blame] | 332 | |
Chris Lattner | d48ce27 | 2006-06-27 18:18:41 +0000 | [diff] [blame] | 333 | //===----------------------------------------------------------------------===// |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 334 | // Fixed point instructions. |
| 335 | // |
| 336 | |
| 337 | let PPC970_Unit = 1 in { // FXU Operations. |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 338 | let Interpretation64Bit = 1 in { |
| 339 | let neverHasSideEffects = 1 in { |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 340 | |
Hal Finkel | 686f2ee | 2012-08-28 02:10:33 +0000 | [diff] [blame] | 341 | let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in { |
Ulrich Weigand | 9948546 | 2013-05-23 22:48:06 +0000 | [diff] [blame] | 342 | def LI8 : DForm_2_r0<14, (outs g8rc:$rD), (ins s16imm64:$imm), |
Hal Finkel | 8c33dde | 2012-06-12 19:01:24 +0000 | [diff] [blame] | 343 | "li $rD, $imm", IntSimple, |
Bill Schmidt | f88571e | 2013-05-22 20:09:24 +0000 | [diff] [blame] | 344 | [(set i64:$rD, imm64SExt16:$imm)]>; |
Ulrich Weigand | 5a02a02 | 2013-06-26 13:49:53 +0000 | [diff] [blame] | 345 | def LIS8 : DForm_2_r0<15, (outs g8rc:$rD), (ins s17imm64:$imm), |
Hal Finkel | 8c33dde | 2012-06-12 19:01:24 +0000 | [diff] [blame] | 346 | "lis $rD, $imm", IntSimple, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 347 | [(set i64:$rD, imm16ShiftedSExt:$imm)]>; |
Hal Finkel | 686f2ee | 2012-08-28 02:10:33 +0000 | [diff] [blame] | 348 | } |
Chris Lattner | 7e742e4 | 2006-06-20 22:34:10 +0000 | [diff] [blame] | 349 | |
| 350 | // Logical ops. |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 351 | defm NAND8: XForm_6r<31, 476, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 352 | "nand", "$rA, $rS, $rB", IntSimple, |
| 353 | [(set i64:$rA, (not (and i64:$rS, i64:$rB)))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 354 | defm AND8 : XForm_6r<31, 28, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 355 | "and", "$rA, $rS, $rB", IntSimple, |
| 356 | [(set i64:$rA, (and i64:$rS, i64:$rB))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 357 | defm ANDC8: XForm_6r<31, 60, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 358 | "andc", "$rA, $rS, $rB", IntSimple, |
| 359 | [(set i64:$rA, (and i64:$rS, (not i64:$rB)))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 360 | defm OR8 : XForm_6r<31, 444, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 361 | "or", "$rA, $rS, $rB", IntSimple, |
| 362 | [(set i64:$rA, (or i64:$rS, i64:$rB))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 363 | defm NOR8 : XForm_6r<31, 124, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 364 | "nor", "$rA, $rS, $rB", IntSimple, |
| 365 | [(set i64:$rA, (not (or i64:$rS, i64:$rB)))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 366 | defm ORC8 : XForm_6r<31, 412, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 367 | "orc", "$rA, $rS, $rB", IntSimple, |
| 368 | [(set i64:$rA, (or i64:$rS, (not i64:$rB)))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 369 | defm EQV8 : XForm_6r<31, 284, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 370 | "eqv", "$rA, $rS, $rB", IntSimple, |
| 371 | [(set i64:$rA, (not (xor i64:$rS, i64:$rB)))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 372 | defm XOR8 : XForm_6r<31, 316, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 373 | "xor", "$rA, $rS, $rB", IntSimple, |
| 374 | [(set i64:$rA, (xor i64:$rS, i64:$rB))]>; |
Chris Lattner | 9d65f35 | 2006-06-20 23:11:59 +0000 | [diff] [blame] | 375 | |
| 376 | // Logical ops with immediate. |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 377 | let Defs = [CR0] in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 378 | def ANDIo8 : DForm_4<28, (outs g8rc:$dst), (ins g8rc:$src1, u16imm:$src2), |
Chris Lattner | 7e742e4 | 2006-06-20 22:34:10 +0000 | [diff] [blame] | 379 | "andi. $dst, $src1, $src2", IntGeneral, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 380 | [(set i64:$dst, (and i64:$src1, immZExt16:$src2))]>, |
Chris Lattner | 7e742e4 | 2006-06-20 22:34:10 +0000 | [diff] [blame] | 381 | isDOT; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 382 | def ANDISo8 : DForm_4<29, (outs g8rc:$dst), (ins g8rc:$src1, u16imm:$src2), |
Chris Lattner | 7e742e4 | 2006-06-20 22:34:10 +0000 | [diff] [blame] | 383 | "andis. $dst, $src1, $src2", IntGeneral, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 384 | [(set i64:$dst, (and i64:$src1, imm16ShiftedZExt:$src2))]>, |
Chris Lattner | 7e742e4 | 2006-06-20 22:34:10 +0000 | [diff] [blame] | 385 | isDOT; |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 386 | } |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 387 | def ORI8 : DForm_4<24, (outs g8rc:$dst), (ins g8rc:$src1, u16imm:$src2), |
Hal Finkel | 8c33dde | 2012-06-12 19:01:24 +0000 | [diff] [blame] | 388 | "ori $dst, $src1, $src2", IntSimple, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 389 | [(set i64:$dst, (or i64:$src1, immZExt16:$src2))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 390 | def ORIS8 : DForm_4<25, (outs g8rc:$dst), (ins g8rc:$src1, u16imm:$src2), |
Hal Finkel | 8c33dde | 2012-06-12 19:01:24 +0000 | [diff] [blame] | 391 | "oris $dst, $src1, $src2", IntSimple, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 392 | [(set i64:$dst, (or i64:$src1, imm16ShiftedZExt:$src2))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 393 | def XORI8 : DForm_4<26, (outs g8rc:$dst), (ins g8rc:$src1, u16imm:$src2), |
Hal Finkel | 8c33dde | 2012-06-12 19:01:24 +0000 | [diff] [blame] | 394 | "xori $dst, $src1, $src2", IntSimple, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 395 | [(set i64:$dst, (xor i64:$src1, immZExt16:$src2))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 396 | def XORIS8 : DForm_4<27, (outs g8rc:$dst), (ins g8rc:$src1, u16imm:$src2), |
Hal Finkel | 8c33dde | 2012-06-12 19:01:24 +0000 | [diff] [blame] | 397 | "xoris $dst, $src1, $src2", IntSimple, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 398 | [(set i64:$dst, (xor i64:$src1, imm16ShiftedZExt:$src2))]>; |
Chris Lattner | 7e742e4 | 2006-06-20 22:34:10 +0000 | [diff] [blame] | 399 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 400 | defm ADD8 : XOForm_1r<31, 266, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 401 | "add", "$rT, $rA, $rB", IntSimple, |
| 402 | [(set i64:$rT, (add i64:$rA, i64:$rB))]>; |
Bill Schmidt | ca4a0c9 | 2012-12-04 16:18:08 +0000 | [diff] [blame] | 403 | // ADD8 has a special form: reg = ADD8(reg, sym@tls) for use by the |
| 404 | // initial-exec thread-local storage model. |
Ulrich Weigand | bbfb0c5 | 2013-03-26 10:57:16 +0000 | [diff] [blame] | 405 | let isCodeGenOnly = 1 in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 406 | def ADD8TLS : XOForm_1<31, 266, 0, (outs g8rc:$rT), (ins g8rc:$rA, tlsreg:$rB), |
Bill Schmidt | 732eb91 | 2012-12-13 18:45:54 +0000 | [diff] [blame] | 407 | "add $rT, $rA, $rB@tls", IntSimple, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 408 | [(set i64:$rT, (add i64:$rA, tglobaltlsaddr:$rB))]>; |
Chris Lattner | 3e549e9 | 2007-05-17 06:52:46 +0000 | [diff] [blame] | 409 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 410 | defm ADDC8 : XOForm_1rc<31, 10, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 411 | "addc", "$rT, $rA, $rB", IntGeneral, |
| 412 | [(set i64:$rT, (addc i64:$rA, i64:$rB))]>, |
| 413 | PPC970_DGroup_Cracked; |
| 414 | let Defs = [CARRY] in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 415 | def ADDIC8 : DForm_2<12, (outs g8rc:$rD), (ins g8rc:$rA, s16imm64:$imm), |
Dale Johannesen | 5e9a5c3 | 2009-09-18 20:15:22 +0000 | [diff] [blame] | 416 | "addic $rD, $rA, $imm", IntGeneral, |
Bill Schmidt | f88571e | 2013-05-22 20:09:24 +0000 | [diff] [blame] | 417 | [(set i64:$rD, (addc i64:$rA, imm64SExt16:$imm))]>; |
Ulrich Weigand | 9948546 | 2013-05-23 22:48:06 +0000 | [diff] [blame] | 418 | def ADDI8 : DForm_2<14, (outs g8rc:$rD), (ins g8rc_nox0:$rA, s16imm64:$imm), |
Hal Finkel | 8c33dde | 2012-06-12 19:01:24 +0000 | [diff] [blame] | 419 | "addi $rD, $rA, $imm", IntSimple, |
Bill Schmidt | f88571e | 2013-05-22 20:09:24 +0000 | [diff] [blame] | 420 | [(set i64:$rD, (add i64:$rA, imm64SExt16:$imm))]>; |
Ulrich Weigand | 5a02a02 | 2013-06-26 13:49:53 +0000 | [diff] [blame] | 421 | def ADDIS8 : DForm_2<15, (outs g8rc:$rD), (ins g8rc_nox0:$rA, s17imm64:$imm), |
Hal Finkel | 8c33dde | 2012-06-12 19:01:24 +0000 | [diff] [blame] | 422 | "addis $rD, $rA, $imm", IntSimple, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 423 | [(set i64:$rD, (add i64:$rA, imm16ShiftedSExt:$imm))]>; |
Chris Lattner | 7e742e4 | 2006-06-20 22:34:10 +0000 | [diff] [blame] | 424 | |
Dale Johannesen | 5e9a5c3 | 2009-09-18 20:15:22 +0000 | [diff] [blame] | 425 | let Defs = [CARRY] in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 426 | def SUBFIC8: DForm_2< 8, (outs g8rc:$rD), (ins g8rc:$rA, s16imm64:$imm), |
Chris Lattner | d48ce27 | 2006-06-27 18:18:41 +0000 | [diff] [blame] | 427 | "subfic $rD, $rA, $imm", IntGeneral, |
Bill Schmidt | f88571e | 2013-05-22 20:09:24 +0000 | [diff] [blame] | 428 | [(set i64:$rD, (subc imm64SExt16:$imm, i64:$rA))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 429 | defm SUBFC8 : XOForm_1r<31, 8, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 430 | "subfc", "$rT, $rA, $rB", IntGeneral, |
| 431 | [(set i64:$rT, (subc i64:$rB, i64:$rA))]>, |
| 432 | PPC970_DGroup_Cracked; |
Dale Johannesen | 5e9a5c3 | 2009-09-18 20:15:22 +0000 | [diff] [blame] | 433 | } |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 434 | defm SUBF8 : XOForm_1r<31, 40, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 435 | "subf", "$rT, $rA, $rB", IntGeneral, |
| 436 | [(set i64:$rT, (sub i64:$rB, i64:$rA))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 437 | defm NEG8 : XOForm_3r<31, 104, 0, (outs g8rc:$rT), (ins g8rc:$rA), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 438 | "neg", "$rT, $rA", IntSimple, |
| 439 | [(set i64:$rT, (ineg i64:$rA))]>; |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 440 | let Uses = [CARRY] in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 441 | defm ADDE8 : XOForm_1rc<31, 138, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 442 | "adde", "$rT, $rA, $rB", IntGeneral, |
| 443 | [(set i64:$rT, (adde i64:$rA, i64:$rB))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 444 | defm ADDME8 : XOForm_3rc<31, 234, 0, (outs g8rc:$rT), (ins g8rc:$rA), |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 445 | "addme", "$rT, $rA", IntGeneral, |
| 446 | [(set i64:$rT, (adde i64:$rA, -1))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 447 | defm ADDZE8 : XOForm_3rc<31, 202, 0, (outs g8rc:$rT), (ins g8rc:$rA), |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 448 | "addze", "$rT, $rA", IntGeneral, |
| 449 | [(set i64:$rT, (adde i64:$rA, 0))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 450 | defm SUBFE8 : XOForm_1rc<31, 136, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 451 | "subfe", "$rT, $rA, $rB", IntGeneral, |
| 452 | [(set i64:$rT, (sube i64:$rB, i64:$rA))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 453 | defm SUBFME8 : XOForm_3rc<31, 232, 0, (outs g8rc:$rT), (ins g8rc:$rA), |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 454 | "subfme", "$rT, $rA", IntGeneral, |
| 455 | [(set i64:$rT, (sube -1, i64:$rA))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 456 | defm SUBFZE8 : XOForm_3rc<31, 200, 0, (outs g8rc:$rT), (ins g8rc:$rA), |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 457 | "subfze", "$rT, $rA", IntGeneral, |
| 458 | [(set i64:$rT, (sube 0, i64:$rA))]>; |
Dale Johannesen | 5e9a5c3 | 2009-09-18 20:15:22 +0000 | [diff] [blame] | 459 | } |
Chris Lattner | 3e549e9 | 2007-05-17 06:52:46 +0000 | [diff] [blame] | 460 | |
Chris Lattner | 2d4e8f7 | 2006-06-20 21:23:06 +0000 | [diff] [blame] | 461 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 462 | defm MULHD : XOForm_1r<31, 73, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 463 | "mulhd", "$rT, $rA, $rB", IntMulHW, |
| 464 | [(set i64:$rT, (mulhs i64:$rA, i64:$rB))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 465 | defm MULHDU : XOForm_1r<31, 9, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 466 | "mulhdu", "$rT, $rA, $rB", IntMulHWU, |
| 467 | [(set i64:$rT, (mulhu i64:$rA, i64:$rB))]>; |
| 468 | } |
| 469 | } // Interpretation64Bit |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 470 | |
Hal Finkel | 95e6ea6 | 2013-04-15 02:37:46 +0000 | [diff] [blame] | 471 | let isCompare = 1, neverHasSideEffects = 1 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 472 | def CMPD : XForm_16_ext<31, 0, (outs crrc:$crD), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 95e6ea6 | 2013-04-15 02:37:46 +0000 | [diff] [blame] | 473 | "cmpd $crD, $rA, $rB", IntCompare>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 474 | def CMPLD : XForm_16_ext<31, 32, (outs crrc:$crD), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 95e6ea6 | 2013-04-15 02:37:46 +0000 | [diff] [blame] | 475 | "cmpld $crD, $rA, $rB", IntCompare>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 476 | def CMPDI : DForm_5_ext<11, (outs crrc:$crD), (ins g8rc:$rA, s16imm:$imm), |
Hal Finkel | 95e6ea6 | 2013-04-15 02:37:46 +0000 | [diff] [blame] | 477 | "cmpdi $crD, $rA, $imm", IntCompare>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 478 | def CMPLDI : DForm_6_ext<10, (outs crrc:$dst), (ins g8rc:$src1, u16imm:$src2), |
Hal Finkel | 95e6ea6 | 2013-04-15 02:37:46 +0000 | [diff] [blame] | 479 | "cmpldi $dst, $src1, $src2", IntCompare>, isPPC64; |
| 480 | } |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 481 | |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 482 | let neverHasSideEffects = 1 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 483 | defm SLD : XForm_6r<31, 27, (outs g8rc:$rA), (ins g8rc:$rS, gprc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 484 | "sld", "$rA, $rS, $rB", IntRotateD, |
| 485 | [(set i64:$rA, (PPCshl i64:$rS, i32:$rB))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 486 | defm SRD : XForm_6r<31, 539, (outs g8rc:$rA), (ins g8rc:$rS, gprc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 487 | "srd", "$rA, $rS, $rB", IntRotateD, |
| 488 | [(set i64:$rA, (PPCsrl i64:$rS, i32:$rB))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 489 | defm SRAD : XForm_6rc<31, 794, (outs g8rc:$rA), (ins g8rc:$rS, gprc:$rB), |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 490 | "srad", "$rA, $rS, $rB", IntRotateD, |
| 491 | [(set i64:$rA, (PPCsra i64:$rS, i32:$rB))]>, isPPC64; |
Chris Lattner | 43c0eb8 | 2006-12-06 21:46:13 +0000 | [diff] [blame] | 492 | |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 493 | let Interpretation64Bit = 1 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 494 | defm EXTSB8 : XForm_11r<31, 954, (outs g8rc:$rA), (ins g8rc:$rS), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 495 | "extsb", "$rA, $rS", IntSimple, |
| 496 | [(set i64:$rA, (sext_inreg i64:$rS, i8))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 497 | defm EXTSH8 : XForm_11r<31, 922, (outs g8rc:$rA), (ins g8rc:$rS), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 498 | "extsh", "$rA, $rS", IntSimple, |
| 499 | [(set i64:$rA, (sext_inreg i64:$rS, i16))]>; |
| 500 | } // Interpretation64Bit |
| 501 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 502 | defm EXTSW : XForm_11r<31, 986, (outs g8rc:$rA), (ins g8rc:$rS), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 503 | "extsw", "$rA, $rS", IntSimple, |
| 504 | [(set i64:$rA, (sext_inreg i64:$rS, i32))]>, isPPC64; |
| 505 | let Interpretation64Bit = 1 in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 506 | defm EXTSW_32_64 : XForm_11r<31, 986, (outs g8rc:$rA), (ins gprc:$rS), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 507 | "extsw", "$rA, $rS", IntSimple, |
| 508 | [(set i64:$rA, (sext i32:$rS))]>, isPPC64; |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 509 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 510 | defm SRADI : XSForm_1rc<31, 413, (outs g8rc:$rA), (ins g8rc:$rS, u6imm:$SH), |
Hal Finkel | 1b58f33 | 2013-04-12 18:17:57 +0000 | [diff] [blame] | 511 | "sradi", "$rA, $rS, $SH", IntRotateDI, |
| 512 | [(set i64:$rA, (sra i64:$rS, (i32 imm:$SH)))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 513 | defm CNTLZD : XForm_11r<31, 58, (outs g8rc:$rA), (ins g8rc:$rS), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 514 | "cntlzd", "$rA, $rS", IntGeneral, |
| 515 | [(set i64:$rA, (ctlz i64:$rS))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 516 | defm POPCNTD : XForm_11r<31, 506, (outs g8rc:$rA), (ins g8rc:$rS), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 517 | "popcntd", "$rA, $rS", IntGeneral, |
| 518 | [(set i64:$rA, (ctpop i64:$rS))]>; |
Chris Lattner | 8810241 | 2007-03-25 04:44:03 +0000 | [diff] [blame] | 519 | |
Hal Finkel | 290376d | 2013-04-01 15:58:15 +0000 | [diff] [blame] | 520 | // popcntw also does a population count on the high 32 bits (storing the |
| 521 | // results in the high 32-bits of the output). We'll ignore that here (which is |
| 522 | // safe because we never separately use the high part of the 64-bit registers). |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 523 | defm POPCNTW : XForm_11r<31, 378, (outs gprc:$rA), (ins gprc:$rS), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 524 | "popcntw", "$rA, $rS", IntGeneral, |
| 525 | [(set i32:$rA, (ctpop i32:$rS))]>; |
Hal Finkel | 290376d | 2013-04-01 15:58:15 +0000 | [diff] [blame] | 526 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 527 | defm DIVD : XOForm_1r<31, 489, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 528 | "divd", "$rT, $rA, $rB", IntDivD, |
| 529 | [(set i64:$rT, (sdiv i64:$rA, i64:$rB))]>, isPPC64, |
| 530 | PPC970_DGroup_First, PPC970_DGroup_Cracked; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 531 | defm DIVDU : XOForm_1r<31, 457, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 532 | "divdu", "$rT, $rA, $rB", IntDivD, |
| 533 | [(set i64:$rT, (udiv i64:$rA, i64:$rB))]>, isPPC64, |
| 534 | PPC970_DGroup_First, PPC970_DGroup_Cracked; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 535 | defm MULLD : XOForm_1r<31, 233, 0, (outs g8rc:$rT), (ins g8rc:$rA, g8rc:$rB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 536 | "mulld", "$rT, $rA, $rB", IntMulHD, |
| 537 | [(set i64:$rT, (mul i64:$rA, i64:$rB))]>, isPPC64; |
| 538 | } |
Chris Lattner | 7ecbd30 | 2006-06-26 23:53:10 +0000 | [diff] [blame] | 539 | |
Hal Finkel | 7795e47 | 2013-04-07 15:06:53 +0000 | [diff] [blame] | 540 | let neverHasSideEffects = 1 in { |
Chris Lattner | 5771156 | 2006-11-15 23:24:18 +0000 | [diff] [blame] | 541 | let isCommutable = 1 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 542 | defm RLDIMI : MDForm_1r<30, 3, (outs g8rc:$rA), |
| 543 | (ins g8rc:$rSi, g8rc:$rS, u6imm:$SH, u6imm:$MBE), |
Ulrich Weigand | fa451ba | 2013-04-26 15:39:12 +0000 | [diff] [blame] | 544 | "rldimi", "$rA, $rS, $SH, $MBE", IntRotateDI, |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 545 | []>, isPPC64, RegConstraint<"$rSi = $rA">, |
| 546 | NoEncode<"$rSi">; |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 547 | } |
| 548 | |
| 549 | // Rotate instructions. |
Ulrich Weigand | fa451ba | 2013-04-26 15:39:12 +0000 | [diff] [blame] | 550 | defm RLDCL : MDSForm_1r<30, 8, |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 551 | (outs g8rc:$rA), (ins g8rc:$rS, gprc:$rB, u6imm:$MBE), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 552 | "rldcl", "$rA, $rS, $rB, $MBE", IntRotateD, |
| 553 | []>, isPPC64; |
Ulrich Weigand | 6c31c4a | 2013-06-25 13:17:10 +0000 | [diff] [blame] | 554 | defm RLDCR : MDSForm_1r<30, 9, |
| 555 | (outs g8rc:$rA), (ins g8rc:$rS, gprc:$rB, u6imm:$MBE), |
| 556 | "rldcr", "$rA, $rS, $rB, $MBE", IntRotateD, |
| 557 | []>, isPPC64; |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 558 | defm RLDICL : MDForm_1r<30, 0, |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 559 | (outs g8rc:$rA), (ins g8rc:$rS, u6imm:$SH, u6imm:$MBE), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 560 | "rldicl", "$rA, $rS, $SH, $MBE", IntRotateDI, |
| 561 | []>, isPPC64; |
| 562 | defm RLDICR : MDForm_1r<30, 1, |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 563 | (outs g8rc:$rA), (ins g8rc:$rS, u6imm:$SH, u6imm:$MBE), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 564 | "rldicr", "$rA, $rS, $SH, $MBE", IntRotateDI, |
| 565 | []>, isPPC64; |
Ulrich Weigand | 6c31c4a | 2013-06-25 13:17:10 +0000 | [diff] [blame] | 566 | defm RLDIC : MDForm_1r<30, 2, |
| 567 | (outs g8rc:$rA), (ins g8rc:$rS, u6imm:$SH, u6imm:$MBE), |
| 568 | "rldic", "$rA, $rS, $SH, $MBE", IntRotateDI, |
| 569 | []>, isPPC64; |
Hal Finkel | ac9df3d | 2011-12-07 06:34:06 +0000 | [diff] [blame] | 570 | |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 571 | let Interpretation64Bit = 1 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 572 | defm RLWINM8 : MForm_2r<21, (outs g8rc:$rA), |
| 573 | (ins g8rc:$rS, u5imm:$SH, u5imm:$MB, u5imm:$ME), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 574 | "rlwinm", "$rA, $rS, $SH, $MB, $ME", IntGeneral, |
| 575 | []>; |
Hal Finkel | ac9df3d | 2011-12-07 06:34:06 +0000 | [diff] [blame] | 576 | |
Hal Finkel | 7795e47 | 2013-04-07 15:06:53 +0000 | [diff] [blame] | 577 | let isSelect = 1 in |
Ulrich Weigand | 84ee76a | 2012-11-13 19:14:19 +0000 | [diff] [blame] | 578 | def ISEL8 : AForm_4<31, 15, |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 579 | (outs g8rc:$rT), (ins g8rc_nox0:$rA, g8rc:$rB, crbitrc:$cond), |
Hal Finkel | 460e94d | 2012-06-22 23:10:08 +0000 | [diff] [blame] | 580 | "isel $rT, $rA, $rB, $cond", IntGeneral, |
| 581 | []>; |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 582 | } // Interpretation64Bit |
Hal Finkel | 7795e47 | 2013-04-07 15:06:53 +0000 | [diff] [blame] | 583 | } // neverHasSideEffects = 1 |
Chris Lattner | 7ecbd30 | 2006-06-26 23:53:10 +0000 | [diff] [blame] | 584 | } // End FXU Operations. |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 585 | |
| 586 | |
| 587 | //===----------------------------------------------------------------------===// |
| 588 | // Load/Store instructions. |
| 589 | // |
| 590 | |
| 591 | |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 592 | // Sign extending loads. |
Dan Gohman | 69cc2cb | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 593 | let canFoldAsLoad = 1, PPC970_Unit = 2 in { |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 594 | let Interpretation64Bit = 1 in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 595 | def LHA8: DForm_1<42, (outs g8rc:$rD), (ins memri:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 596 | "lha $rD, $src", LdStLHA, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 597 | [(set i64:$rD, (sextloadi16 iaddr:$src))]>, |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 598 | PPC970_DGroup_Cracked; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 599 | def LWA : DSForm_1<58, 2, (outs g8rc:$rD), (ins memrix:$src), |
Chris Lattner | 94d18df | 2006-06-20 00:38:36 +0000 | [diff] [blame] | 600 | "lwa $rD, $src", LdStLWA, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 601 | [(set i64:$rD, |
Hal Finkel | b09680b | 2013-03-18 23:00:58 +0000 | [diff] [blame] | 602 | (aligned4sextloadi32 ixaddr:$src))]>, isPPC64, |
Chris Lattner | 94d18df | 2006-06-20 00:38:36 +0000 | [diff] [blame] | 603 | PPC970_DGroup_Cracked; |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 604 | let Interpretation64Bit = 1 in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 605 | def LHAX8: XForm_1<31, 343, (outs g8rc:$rD), (ins memrr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 606 | "lhax $rD, $src", LdStLHA, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 607 | [(set i64:$rD, (sextloadi16 xaddr:$src))]>, |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 608 | PPC970_DGroup_Cracked; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 609 | def LWAX : XForm_1<31, 341, (outs g8rc:$rD), (ins memrr:$src), |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 610 | "lwax $rD, $src", LdStLHA, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 611 | [(set i64:$rD, (sextloadi32 xaddr:$src))]>, isPPC64, |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 612 | PPC970_DGroup_Cracked; |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 613 | |
Chris Lattner | c9fa36d | 2006-11-10 23:58:45 +0000 | [diff] [blame] | 614 | // Update forms. |
Hal Finkel | d71cc3a | 2013-04-07 06:30:47 +0000 | [diff] [blame] | 615 | let mayLoad = 1, neverHasSideEffects = 1 in { |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 616 | let Interpretation64Bit = 1 in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 617 | def LHAU8 : DForm_1<43, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), |
Ulrich Weigand | f803009 | 2013-03-19 19:52:30 +0000 | [diff] [blame] | 618 | (ins memri:$addr), |
| 619 | "lhau $rD, $addr", LdStLHAU, |
| 620 | []>, RegConstraint<"$addr.reg = $ea_result">, |
Chris Lattner | 5771156 | 2006-11-15 23:24:18 +0000 | [diff] [blame] | 621 | NoEncode<"$ea_result">; |
Chris Lattner | c9fa36d | 2006-11-10 23:58:45 +0000 | [diff] [blame] | 622 | // NO LWAU! |
| 623 | |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 624 | let Interpretation64Bit = 1 in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 625 | def LHAUX8 : XForm_1<31, 375, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 626 | (ins memrr:$addr), |
Hal Finkel | 679c73c | 2012-08-28 02:49:14 +0000 | [diff] [blame] | 627 | "lhaux $rD, $addr", LdStLHAU, |
Ulrich Weigand | 1df06d8 | 2013-03-22 14:59:13 +0000 | [diff] [blame] | 628 | []>, RegConstraint<"$addr.ptrreg = $ea_result">, |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 629 | NoEncode<"$ea_result">; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 630 | def LWAUX : XForm_1<31, 373, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 631 | (ins memrr:$addr), |
Hal Finkel | 679c73c | 2012-08-28 02:49:14 +0000 | [diff] [blame] | 632 | "lwaux $rD, $addr", LdStLHAU, |
Ulrich Weigand | 1df06d8 | 2013-03-22 14:59:13 +0000 | [diff] [blame] | 633 | []>, RegConstraint<"$addr.ptrreg = $ea_result">, |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 634 | NoEncode<"$ea_result">, isPPC64; |
Chris Lattner | c9fa36d | 2006-11-10 23:58:45 +0000 | [diff] [blame] | 635 | } |
Ulrich Weigand | 01dd4c1 | 2013-03-19 19:53:27 +0000 | [diff] [blame] | 636 | } |
Chris Lattner | c9fa36d | 2006-11-10 23:58:45 +0000 | [diff] [blame] | 637 | |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 638 | let Interpretation64Bit = 1 in { |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 639 | // Zero extending loads. |
Dan Gohman | 69cc2cb | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 640 | let canFoldAsLoad = 1, PPC970_Unit = 2 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 641 | def LBZ8 : DForm_1<34, (outs g8rc:$rD), (ins memri:$src), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 642 | "lbz $rD, $src", LdStLoad, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 643 | [(set i64:$rD, (zextloadi8 iaddr:$src))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 644 | def LHZ8 : DForm_1<40, (outs g8rc:$rD), (ins memri:$src), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 645 | "lhz $rD, $src", LdStLoad, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 646 | [(set i64:$rD, (zextloadi16 iaddr:$src))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 647 | def LWZ8 : DForm_1<32, (outs g8rc:$rD), (ins memri:$src), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 648 | "lwz $rD, $src", LdStLoad, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 649 | [(set i64:$rD, (zextloadi32 iaddr:$src))]>, isPPC64; |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 650 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 651 | def LBZX8 : XForm_1<31, 87, (outs g8rc:$rD), (ins memrr:$src), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 652 | "lbzx $rD, $src", LdStLoad, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 653 | [(set i64:$rD, (zextloadi8 xaddr:$src))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 654 | def LHZX8 : XForm_1<31, 279, (outs g8rc:$rD), (ins memrr:$src), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 655 | "lhzx $rD, $src", LdStLoad, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 656 | [(set i64:$rD, (zextloadi16 xaddr:$src))]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 657 | def LWZX8 : XForm_1<31, 23, (outs g8rc:$rD), (ins memrr:$src), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 658 | "lwzx $rD, $src", LdStLoad, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 659 | [(set i64:$rD, (zextloadi32 xaddr:$src))]>; |
Chris Lattner | c9fa36d | 2006-11-10 23:58:45 +0000 | [diff] [blame] | 660 | |
| 661 | |
| 662 | // Update forms. |
Hal Finkel | 6efd45e | 2013-04-07 05:46:58 +0000 | [diff] [blame] | 663 | let mayLoad = 1, neverHasSideEffects = 1 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 664 | def LBZU8 : DForm_1<35, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), (ins memri:$addr), |
Hal Finkel | 679c73c | 2012-08-28 02:49:14 +0000 | [diff] [blame] | 665 | "lbzu $rD, $addr", LdStLoadUpd, |
Chris Lattner | 5771156 | 2006-11-15 23:24:18 +0000 | [diff] [blame] | 666 | []>, RegConstraint<"$addr.reg = $ea_result">, |
| 667 | NoEncode<"$ea_result">; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 668 | def LHZU8 : DForm_1<41, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), (ins memri:$addr), |
Hal Finkel | 679c73c | 2012-08-28 02:49:14 +0000 | [diff] [blame] | 669 | "lhzu $rD, $addr", LdStLoadUpd, |
Chris Lattner | 5771156 | 2006-11-15 23:24:18 +0000 | [diff] [blame] | 670 | []>, RegConstraint<"$addr.reg = $ea_result">, |
| 671 | NoEncode<"$ea_result">; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 672 | def LWZU8 : DForm_1<33, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), (ins memri:$addr), |
Hal Finkel | 679c73c | 2012-08-28 02:49:14 +0000 | [diff] [blame] | 673 | "lwzu $rD, $addr", LdStLoadUpd, |
Chris Lattner | 5771156 | 2006-11-15 23:24:18 +0000 | [diff] [blame] | 674 | []>, RegConstraint<"$addr.reg = $ea_result">, |
| 675 | NoEncode<"$ea_result">; |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 676 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 677 | def LBZUX8 : XForm_1<31, 119, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 678 | (ins memrr:$addr), |
Hal Finkel | 679c73c | 2012-08-28 02:49:14 +0000 | [diff] [blame] | 679 | "lbzux $rD, $addr", LdStLoadUpd, |
Ulrich Weigand | 1df06d8 | 2013-03-22 14:59:13 +0000 | [diff] [blame] | 680 | []>, RegConstraint<"$addr.ptrreg = $ea_result">, |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 681 | NoEncode<"$ea_result">; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 682 | def LHZUX8 : XForm_1<31, 311, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 683 | (ins memrr:$addr), |
Hal Finkel | 679c73c | 2012-08-28 02:49:14 +0000 | [diff] [blame] | 684 | "lhzux $rD, $addr", LdStLoadUpd, |
Ulrich Weigand | 1df06d8 | 2013-03-22 14:59:13 +0000 | [diff] [blame] | 685 | []>, RegConstraint<"$addr.ptrreg = $ea_result">, |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 686 | NoEncode<"$ea_result">; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 687 | def LWZUX8 : XForm_1<31, 55, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 688 | (ins memrr:$addr), |
Hal Finkel | 679c73c | 2012-08-28 02:49:14 +0000 | [diff] [blame] | 689 | "lwzux $rD, $addr", LdStLoadUpd, |
Ulrich Weigand | 1df06d8 | 2013-03-22 14:59:13 +0000 | [diff] [blame] | 690 | []>, RegConstraint<"$addr.ptrreg = $ea_result">, |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 691 | NoEncode<"$ea_result">; |
Chris Lattner | c9fa36d | 2006-11-10 23:58:45 +0000 | [diff] [blame] | 692 | } |
Dan Gohman | ae3ba45 | 2008-12-03 02:30:17 +0000 | [diff] [blame] | 693 | } |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 694 | } // Interpretation64Bit |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 695 | |
| 696 | |
| 697 | // Full 8-byte loads. |
Dan Gohman | 69cc2cb | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 698 | let canFoldAsLoad = 1, PPC970_Unit = 2 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 699 | def LD : DSForm_1<58, 0, (outs g8rc:$rD), (ins memrix:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 700 | "ld $rD, $src", LdStLD, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 701 | [(set i64:$rD, (aligned4load ixaddr:$src))]>, isPPC64; |
Bill Schmidt | 34627e3 | 2012-11-27 17:35:46 +0000 | [diff] [blame] | 702 | // The following three definitions are selected for small code model only. |
| 703 | // Otherwise, we need to create two instructions to form a 32-bit offset, |
| 704 | // so we have a custom matcher for TOC_ENTRY in PPCDAGToDAGIsel::Select(). |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 705 | def LDtoc: Pseudo<(outs g8rc:$rD), (ins tocentry:$disp, g8rc:$reg), |
Will Schmidt | 4a67f2e | 2012-10-04 18:14:28 +0000 | [diff] [blame] | 706 | "#LDtoc", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 707 | [(set i64:$rD, |
| 708 | (PPCtoc_entry tglobaladdr:$disp, i64:$reg))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 709 | def LDtocJTI: Pseudo<(outs g8rc:$rD), (ins tocentry:$disp, g8rc:$reg), |
Will Schmidt | 4a67f2e | 2012-10-04 18:14:28 +0000 | [diff] [blame] | 710 | "#LDtocJTI", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 711 | [(set i64:$rD, |
| 712 | (PPCtoc_entry tjumptable:$disp, i64:$reg))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 713 | def LDtocCPT: Pseudo<(outs g8rc:$rD), (ins tocentry:$disp, g8rc:$reg), |
Will Schmidt | 4a67f2e | 2012-10-04 18:14:28 +0000 | [diff] [blame] | 714 | "#LDtocCPT", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 715 | [(set i64:$rD, |
| 716 | (PPCtoc_entry tconstpool:$disp, i64:$reg))]>, isPPC64; |
Hal Finkel | a3e6ed2 | 2012-02-24 17:54:01 +0000 | [diff] [blame] | 717 | |
Ulrich Weigand | bbfb0c5 | 2013-03-26 10:57:16 +0000 | [diff] [blame] | 718 | let hasSideEffects = 1, isCodeGenOnly = 1 in { |
Adhemerval Zanella | 1be10dc | 2012-10-25 14:29:13 +0000 | [diff] [blame] | 719 | let RST = 2, DS = 2 in |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 720 | def LDinto_toc: DSForm_1a<58, 0, (outs), (ins g8rc:$reg), |
Tilmann Scheller | 79fef93 | 2009-12-18 13:00:15 +0000 | [diff] [blame] | 721 | "ld 2, 8($reg)", LdStLD, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 722 | [(PPCload_toc i64:$reg)]>, isPPC64; |
Chris Lattner | 7077efe | 2010-11-14 22:48:15 +0000 | [diff] [blame] | 723 | |
Adhemerval Zanella | 1be10dc | 2012-10-25 14:29:13 +0000 | [diff] [blame] | 724 | let RST = 2, DS = 10, RA = 1 in |
| 725 | def LDtoc_restore : DSForm_1a<58, 0, (outs), (ins), |
Tilmann Scheller | 79fef93 | 2009-12-18 13:00:15 +0000 | [diff] [blame] | 726 | "ld 2, 40(1)", LdStLD, |
Chris Lattner | 94f0c14 | 2010-11-14 22:22:59 +0000 | [diff] [blame] | 727 | [(PPCtoc_restore)]>, isPPC64; |
Hal Finkel | a3e6ed2 | 2012-02-24 17:54:01 +0000 | [diff] [blame] | 728 | } |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 729 | def LDX : XForm_1<31, 21, (outs g8rc:$rD), (ins memrr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 730 | "ldx $rD, $src", LdStLD, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 731 | [(set i64:$rD, (load xaddr:$src))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 732 | def LDBRX : XForm_1<31, 532, (outs g8rc:$rD), (ins memrr:$src), |
Hal Finkel | 31d2956 | 2013-03-28 19:25:55 +0000 | [diff] [blame] | 733 | "ldbrx $rD, $src", LdStLoad, |
| 734 | [(set i64:$rD, (PPClbrx xoaddr:$src, i64))]>, isPPC64; |
| 735 | |
Hal Finkel | d71cc3a | 2013-04-07 06:30:47 +0000 | [diff] [blame] | 736 | let mayLoad = 1, neverHasSideEffects = 1 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 737 | def LDU : DSForm_1<58, 1, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), (ins memrix:$addr), |
Hal Finkel | 679c73c | 2012-08-28 02:49:14 +0000 | [diff] [blame] | 738 | "ldu $rD, $addr", LdStLDU, |
Chris Lattner | 5771156 | 2006-11-15 23:24:18 +0000 | [diff] [blame] | 739 | []>, RegConstraint<"$addr.reg = $ea_result">, isPPC64, |
| 740 | NoEncode<"$ea_result">; |
Chris Lattner | c9fa36d | 2006-11-10 23:58:45 +0000 | [diff] [blame] | 741 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 742 | def LDUX : XForm_1<31, 53, (outs g8rc:$rD, ptr_rc_nor0:$ea_result), |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 743 | (ins memrr:$addr), |
Hal Finkel | 679c73c | 2012-08-28 02:49:14 +0000 | [diff] [blame] | 744 | "ldux $rD, $addr", LdStLDU, |
Ulrich Weigand | 1df06d8 | 2013-03-22 14:59:13 +0000 | [diff] [blame] | 745 | []>, RegConstraint<"$addr.ptrreg = $ea_result">, |
Hal Finkel | ca542be | 2012-06-20 15:43:03 +0000 | [diff] [blame] | 746 | NoEncode<"$ea_result">, isPPC64; |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 747 | } |
Hal Finkel | d71cc3a | 2013-04-07 06:30:47 +0000 | [diff] [blame] | 748 | } |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 749 | |
Tilmann Scheller | 79fef93 | 2009-12-18 13:00:15 +0000 | [diff] [blame] | 750 | def : Pat<(PPCload ixaddr:$src), |
| 751 | (LD ixaddr:$src)>; |
| 752 | def : Pat<(PPCload xaddr:$src), |
| 753 | (LDX xaddr:$src)>; |
| 754 | |
Bill Schmidt | 2791778 | 2013-02-21 17:12:27 +0000 | [diff] [blame] | 755 | // Support for medium and large code model. |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 756 | def ADDIStocHA: Pseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, tocentry:$disp), |
Bill Schmidt | 34627e3 | 2012-11-27 17:35:46 +0000 | [diff] [blame] | 757 | "#ADDIStocHA", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 758 | [(set i64:$rD, |
| 759 | (PPCaddisTocHA i64:$reg, tglobaladdr:$disp))]>, |
Bill Schmidt | 34627e3 | 2012-11-27 17:35:46 +0000 | [diff] [blame] | 760 | isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 761 | def LDtocL: Pseudo<(outs g8rc:$rD), (ins tocentry:$disp, g8rc_nox0:$reg), |
Bill Schmidt | 34627e3 | 2012-11-27 17:35:46 +0000 | [diff] [blame] | 762 | "#LDtocL", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 763 | [(set i64:$rD, |
| 764 | (PPCldTocL tglobaladdr:$disp, i64:$reg))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 765 | def ADDItocL: Pseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, tocentry:$disp), |
Bill Schmidt | 34627e3 | 2012-11-27 17:35:46 +0000 | [diff] [blame] | 766 | "#ADDItocL", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 767 | [(set i64:$rD, |
| 768 | (PPCaddiTocL i64:$reg, tglobaladdr:$disp))]>, isPPC64; |
Bill Schmidt | 34627e3 | 2012-11-27 17:35:46 +0000 | [diff] [blame] | 769 | |
Bill Schmidt | ca4a0c9 | 2012-12-04 16:18:08 +0000 | [diff] [blame] | 770 | // Support for thread-local storage. |
Ulrich Weigand | 9948546 | 2013-05-23 22:48:06 +0000 | [diff] [blame] | 771 | def ADDISgotTprelHA: Pseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, s16imm64:$disp), |
Bill Schmidt | 9f0b4ec | 2012-12-14 17:02:38 +0000 | [diff] [blame] | 772 | "#ADDISgotTprelHA", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 773 | [(set i64:$rD, |
| 774 | (PPCaddisGotTprelHA i64:$reg, |
Bill Schmidt | 9f0b4ec | 2012-12-14 17:02:38 +0000 | [diff] [blame] | 775 | tglobaltlsaddr:$disp))]>, |
| 776 | isPPC64; |
Ulrich Weigand | 9948546 | 2013-05-23 22:48:06 +0000 | [diff] [blame] | 777 | def LDgotTprelL: Pseudo<(outs g8rc:$rD), (ins s16imm64:$disp, g8rc_nox0:$reg), |
Bill Schmidt | 9f0b4ec | 2012-12-14 17:02:38 +0000 | [diff] [blame] | 778 | "#LDgotTprelL", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 779 | [(set i64:$rD, |
| 780 | (PPCldGotTprelL tglobaltlsaddr:$disp, i64:$reg))]>, |
Bill Schmidt | 9f0b4ec | 2012-12-14 17:02:38 +0000 | [diff] [blame] | 781 | isPPC64; |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 782 | def : Pat<(PPCaddTls i64:$in, tglobaltlsaddr:$g), |
| 783 | (ADD8TLS $in, tglobaltlsaddr:$g)>; |
Ulrich Weigand | 9948546 | 2013-05-23 22:48:06 +0000 | [diff] [blame] | 784 | def ADDIStlsgdHA: Pseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, s16imm64:$disp), |
Bill Schmidt | c56f1d3 | 2012-12-11 20:30:11 +0000 | [diff] [blame] | 785 | "#ADDIStlsgdHA", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 786 | [(set i64:$rD, |
| 787 | (PPCaddisTlsgdHA i64:$reg, tglobaltlsaddr:$disp))]>, |
Bill Schmidt | c56f1d3 | 2012-12-11 20:30:11 +0000 | [diff] [blame] | 788 | isPPC64; |
Ulrich Weigand | 9948546 | 2013-05-23 22:48:06 +0000 | [diff] [blame] | 789 | def ADDItlsgdL : Pseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, s16imm64:$disp), |
Bill Schmidt | c56f1d3 | 2012-12-11 20:30:11 +0000 | [diff] [blame] | 790 | "#ADDItlsgdL", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 791 | [(set i64:$rD, |
| 792 | (PPCaddiTlsgdL i64:$reg, tglobaltlsaddr:$disp))]>, |
Bill Schmidt | c56f1d3 | 2012-12-11 20:30:11 +0000 | [diff] [blame] | 793 | isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 794 | def GETtlsADDR : Pseudo<(outs g8rc:$rD), (ins g8rc:$reg, tlsgd:$sym), |
Bill Schmidt | c56f1d3 | 2012-12-11 20:30:11 +0000 | [diff] [blame] | 795 | "#GETtlsADDR", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 796 | [(set i64:$rD, |
| 797 | (PPCgetTlsAddr i64:$reg, tglobaltlsaddr:$sym))]>, |
Bill Schmidt | c56f1d3 | 2012-12-11 20:30:11 +0000 | [diff] [blame] | 798 | isPPC64; |
Ulrich Weigand | 9948546 | 2013-05-23 22:48:06 +0000 | [diff] [blame] | 799 | def ADDIStlsldHA: Pseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, s16imm64:$disp), |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 800 | "#ADDIStlsldHA", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 801 | [(set i64:$rD, |
| 802 | (PPCaddisTlsldHA i64:$reg, tglobaltlsaddr:$disp))]>, |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 803 | isPPC64; |
Ulrich Weigand | 9948546 | 2013-05-23 22:48:06 +0000 | [diff] [blame] | 804 | def ADDItlsldL : Pseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, s16imm64:$disp), |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 805 | "#ADDItlsldL", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 806 | [(set i64:$rD, |
| 807 | (PPCaddiTlsldL i64:$reg, tglobaltlsaddr:$disp))]>, |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 808 | isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 809 | def GETtlsldADDR : Pseudo<(outs g8rc:$rD), (ins g8rc:$reg, tlsgd:$sym), |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 810 | "#GETtlsldADDR", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 811 | [(set i64:$rD, |
| 812 | (PPCgetTlsldAddr i64:$reg, tglobaltlsaddr:$sym))]>, |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 813 | isPPC64; |
Ulrich Weigand | 9948546 | 2013-05-23 22:48:06 +0000 | [diff] [blame] | 814 | def ADDISdtprelHA: Pseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, s16imm64:$disp), |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 815 | "#ADDISdtprelHA", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 816 | [(set i64:$rD, |
| 817 | (PPCaddisDtprelHA i64:$reg, |
Bill Schmidt | 9ed4dbc | 2012-12-13 20:57:10 +0000 | [diff] [blame] | 818 | tglobaltlsaddr:$disp))]>, |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 819 | isPPC64; |
Ulrich Weigand | 9948546 | 2013-05-23 22:48:06 +0000 | [diff] [blame] | 820 | def ADDIdtprelL : Pseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, s16imm64:$disp), |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 821 | "#ADDIdtprelL", |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 822 | [(set i64:$rD, |
| 823 | (PPCaddiDtprelL i64:$reg, tglobaltlsaddr:$disp))]>, |
Bill Schmidt | 24b8dd6 | 2012-12-12 19:29:35 +0000 | [diff] [blame] | 824 | isPPC64; |
Bill Schmidt | ca4a0c9 | 2012-12-04 16:18:08 +0000 | [diff] [blame] | 825 | |
Chris Lattner | e20f380 | 2008-01-06 05:53:26 +0000 | [diff] [blame] | 826 | let PPC970_Unit = 2 in { |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 827 | let Interpretation64Bit = 1 in { |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 828 | // Truncating stores. |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 829 | def STB8 : DForm_1<38, (outs), (ins g8rc:$rS, memri:$src), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 830 | "stb $rS, $src", LdStStore, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 831 | [(truncstorei8 i64:$rS, iaddr:$src)]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 832 | def STH8 : DForm_1<44, (outs), (ins g8rc:$rS, memri:$src), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 833 | "sth $rS, $src", LdStStore, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 834 | [(truncstorei16 i64:$rS, iaddr:$src)]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 835 | def STW8 : DForm_1<36, (outs), (ins g8rc:$rS, memri:$src), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 836 | "stw $rS, $src", LdStStore, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 837 | [(truncstorei32 i64:$rS, iaddr:$src)]>; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 838 | def STBX8 : XForm_8<31, 215, (outs), (ins g8rc:$rS, memrr:$dst), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 839 | "stbx $rS, $dst", LdStStore, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 840 | [(truncstorei8 i64:$rS, xaddr:$dst)]>, |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 841 | PPC970_DGroup_Cracked; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 842 | def STHX8 : XForm_8<31, 407, (outs), (ins g8rc:$rS, memrr:$dst), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 843 | "sthx $rS, $dst", LdStStore, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 844 | [(truncstorei16 i64:$rS, xaddr:$dst)]>, |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 845 | PPC970_DGroup_Cracked; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 846 | def STWX8 : XForm_8<31, 151, (outs), (ins g8rc:$rS, memrr:$dst), |
Hal Finkel | 59607e6 | 2012-04-01 04:44:16 +0000 | [diff] [blame] | 847 | "stwx $rS, $dst", LdStStore, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 848 | [(truncstorei32 i64:$rS, xaddr:$dst)]>, |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 849 | PPC970_DGroup_Cracked; |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 850 | } // Interpretation64Bit |
| 851 | |
Chris Lattner | e742d9a | 2006-11-16 00:57:19 +0000 | [diff] [blame] | 852 | // Normal 8-byte stores. |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 853 | def STD : DSForm_1<62, 0, (outs), (ins g8rc:$rS, memrix:$dst), |
Chris Lattner | e742d9a | 2006-11-16 00:57:19 +0000 | [diff] [blame] | 854 | "std $rS, $dst", LdStSTD, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 855 | [(aligned4store i64:$rS, ixaddr:$dst)]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 856 | def STDX : XForm_8<31, 149, (outs), (ins g8rc:$rS, memrr:$dst), |
Chris Lattner | e742d9a | 2006-11-16 00:57:19 +0000 | [diff] [blame] | 857 | "stdx $rS, $dst", LdStSTD, |
Ulrich Weigand | c886810 | 2013-03-25 19:05:30 +0000 | [diff] [blame] | 858 | [(store i64:$rS, xaddr:$dst)]>, isPPC64, |
Chris Lattner | e742d9a | 2006-11-16 00:57:19 +0000 | [diff] [blame] | 859 | PPC970_DGroup_Cracked; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 860 | def STDBRX: XForm_8<31, 660, (outs), (ins g8rc:$rS, memrr:$dst), |
Hal Finkel | 31d2956 | 2013-03-28 19:25:55 +0000 | [diff] [blame] | 861 | "stdbrx $rS, $dst", LdStStore, |
| 862 | [(PPCstbrx i64:$rS, xoaddr:$dst, i64)]>, isPPC64, |
| 863 | PPC970_DGroup_Cracked; |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 864 | } |
| 865 | |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 866 | // Stores with Update (pre-inc). |
| 867 | let PPC970_Unit = 2, mayStore = 1 in { |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 868 | let Interpretation64Bit = 1 in { |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 869 | def STBU8 : DForm_1<39, (outs ptr_rc_nor0:$ea_res), (ins g8rc:$rS, memri:$dst), |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 870 | "stbu $rS, $dst", LdStStoreUpd, []>, |
| 871 | RegConstraint<"$dst.reg = $ea_res">, NoEncode<"$ea_res">; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 872 | def STHU8 : DForm_1<45, (outs ptr_rc_nor0:$ea_res), (ins g8rc:$rS, memri:$dst), |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 873 | "sthu $rS, $dst", LdStStoreUpd, []>, |
| 874 | RegConstraint<"$dst.reg = $ea_res">, NoEncode<"$ea_res">; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 875 | def STWU8 : DForm_1<37, (outs ptr_rc_nor0:$ea_res), (ins g8rc:$rS, memri:$dst), |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 876 | "stwu $rS, $dst", LdStStoreUpd, []>, |
| 877 | RegConstraint<"$dst.reg = $ea_res">, NoEncode<"$ea_res">; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 878 | def STDU : DSForm_1<62, 1, (outs ptr_rc_nor0:$ea_res), (ins g8rc:$rS, memrix:$dst), |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 879 | "stdu $rS, $dst", LdStSTDU, []>, |
| 880 | RegConstraint<"$dst.reg = $ea_res">, NoEncode<"$ea_res">, |
| 881 | isPPC64; |
| 882 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 883 | def STBUX8: XForm_8<31, 247, (outs ptr_rc_nor0:$ea_res), (ins g8rc:$rS, memrr:$dst), |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 884 | "stbux $rS, $dst", LdStStoreUpd, []>, |
Ulrich Weigand | 1df06d8 | 2013-03-22 14:59:13 +0000 | [diff] [blame] | 885 | RegConstraint<"$dst.ptrreg = $ea_res">, NoEncode<"$ea_res">, |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 886 | PPC970_DGroup_Cracked; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 887 | def STHUX8: XForm_8<31, 439, (outs ptr_rc_nor0:$ea_res), (ins g8rc:$rS, memrr:$dst), |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 888 | "sthux $rS, $dst", LdStStoreUpd, []>, |
Ulrich Weigand | 1df06d8 | 2013-03-22 14:59:13 +0000 | [diff] [blame] | 889 | RegConstraint<"$dst.ptrreg = $ea_res">, NoEncode<"$ea_res">, |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 890 | PPC970_DGroup_Cracked; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 891 | def STWUX8: XForm_8<31, 183, (outs ptr_rc_nor0:$ea_res), (ins g8rc:$rS, memrr:$dst), |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 892 | "stwux $rS, $dst", LdStStoreUpd, []>, |
Ulrich Weigand | 1df06d8 | 2013-03-22 14:59:13 +0000 | [diff] [blame] | 893 | RegConstraint<"$dst.ptrreg = $ea_res">, NoEncode<"$ea_res">, |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 894 | PPC970_DGroup_Cracked; |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 895 | } // Interpretation64Bit |
| 896 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 897 | def STDUX : XForm_8<31, 181, (outs ptr_rc_nor0:$ea_res), (ins g8rc:$rS, memrr:$dst), |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 898 | "stdux $rS, $dst", LdStSTDU, []>, |
Ulrich Weigand | 1df06d8 | 2013-03-22 14:59:13 +0000 | [diff] [blame] | 899 | RegConstraint<"$dst.ptrreg = $ea_res">, NoEncode<"$ea_res">, |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 900 | PPC970_DGroup_Cracked, isPPC64; |
| 901 | } |
| 902 | |
| 903 | // Patterns to match the pre-inc stores. We can't put the patterns on |
| 904 | // the instruction definitions directly as ISel wants the address base |
| 905 | // and offset to be separate operands, not a single complex operand. |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 906 | def : Pat<(pre_truncsti8 i64:$rS, iPTR:$ptrreg, iaddroff:$ptroff), |
| 907 | (STBU8 $rS, iaddroff:$ptroff, $ptrreg)>; |
| 908 | def : Pat<(pre_truncsti16 i64:$rS, iPTR:$ptrreg, iaddroff:$ptroff), |
| 909 | (STHU8 $rS, iaddroff:$ptroff, $ptrreg)>; |
| 910 | def : Pat<(pre_truncsti32 i64:$rS, iPTR:$ptrreg, iaddroff:$ptroff), |
| 911 | (STWU8 $rS, iaddroff:$ptroff, $ptrreg)>; |
| 912 | def : Pat<(aligned4pre_store i64:$rS, iPTR:$ptrreg, iaddroff:$ptroff), |
| 913 | (STDU $rS, iaddroff:$ptroff, $ptrreg)>; |
Ulrich Weigand | d850167 | 2013-03-19 19:52:04 +0000 | [diff] [blame] | 914 | |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 915 | def : Pat<(pre_truncsti8 i64:$rS, iPTR:$ptrreg, iPTR:$ptroff), |
| 916 | (STBUX8 $rS, $ptrreg, $ptroff)>; |
| 917 | def : Pat<(pre_truncsti16 i64:$rS, iPTR:$ptrreg, iPTR:$ptroff), |
| 918 | (STHUX8 $rS, $ptrreg, $ptroff)>; |
| 919 | def : Pat<(pre_truncsti32 i64:$rS, iPTR:$ptrreg, iPTR:$ptroff), |
| 920 | (STWUX8 $rS, $ptrreg, $ptroff)>; |
| 921 | def : Pat<(pre_store i64:$rS, iPTR:$ptrreg, iPTR:$ptroff), |
| 922 | (STDUX $rS, $ptrreg, $ptroff)>; |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 923 | |
| 924 | |
| 925 | //===----------------------------------------------------------------------===// |
| 926 | // Floating point instructions. |
| 927 | // |
| 928 | |
| 929 | |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 930 | let PPC970_Unit = 3, neverHasSideEffects = 1, |
| 931 | Uses = [RM] in { // FPU Operations. |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 932 | defm FCFID : XForm_26r<63, 846, (outs f8rc:$frD), (ins f8rc:$frB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 933 | "fcfid", "$frD, $frB", FPGeneral, |
| 934 | [(set f64:$frD, (PPCfcfid f64:$frB))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 935 | defm FCTIDZ : XForm_26r<63, 815, (outs f8rc:$frD), (ins f8rc:$frB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 936 | "fctidz", "$frD, $frB", FPGeneral, |
| 937 | [(set f64:$frD, (PPCfctidz f64:$frB))]>, isPPC64; |
Hal Finkel | f6d45f2 | 2013-04-01 17:52:07 +0000 | [diff] [blame] | 938 | |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 939 | defm FCFIDU : XForm_26r<63, 974, (outs f8rc:$frD), (ins f8rc:$frB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 940 | "fcfidu", "$frD, $frB", FPGeneral, |
| 941 | [(set f64:$frD, (PPCfcfidu f64:$frB))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 942 | defm FCFIDS : XForm_26r<59, 846, (outs f4rc:$frD), (ins f8rc:$frB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 943 | "fcfids", "$frD, $frB", FPGeneral, |
| 944 | [(set f32:$frD, (PPCfcfids f64:$frB))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 945 | defm FCFIDUS : XForm_26r<59, 974, (outs f4rc:$frD), (ins f8rc:$frB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 946 | "fcfidus", "$frD, $frB", FPGeneral, |
| 947 | [(set f32:$frD, (PPCfcfidus f64:$frB))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 948 | defm FCTIDUZ : XForm_26r<63, 943, (outs f8rc:$frD), (ins f8rc:$frB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 949 | "fctiduz", "$frD, $frB", FPGeneral, |
| 950 | [(set f64:$frD, (PPCfctiduz f64:$frB))]>, isPPC64; |
Ulrich Weigand | 136ac22 | 2013-04-26 16:53:15 +0000 | [diff] [blame] | 951 | defm FCTIWUZ : XForm_26r<63, 143, (outs f8rc:$frD), (ins f8rc:$frB), |
Hal Finkel | 654d43b | 2013-04-12 02:18:09 +0000 | [diff] [blame] | 952 | "fctiwuz", "$frD, $frB", FPGeneral, |
| 953 | [(set f64:$frD, (PPCfctiwuz f64:$frB))]>, isPPC64; |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 954 | } |
| 955 | |
| 956 | |
| 957 | //===----------------------------------------------------------------------===// |
| 958 | // Instruction Patterns |
| 959 | // |
Chris Lattner | 7e742e4 | 2006-06-20 22:34:10 +0000 | [diff] [blame] | 960 | |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 961 | // Extensions and truncates to/from 32-bit regs. |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 962 | def : Pat<(i64 (zext i32:$in)), |
| 963 | (RLDICL (INSERT_SUBREG (i64 (IMPLICIT_DEF)), $in, sub_32), |
Hal Finkel | 2edfbdd | 2012-06-09 22:10:19 +0000 | [diff] [blame] | 964 | 0, 32)>; |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 965 | def : Pat<(i64 (anyext i32:$in)), |
| 966 | (INSERT_SUBREG (i64 (IMPLICIT_DEF)), $in, sub_32)>; |
| 967 | def : Pat<(i32 (trunc i64:$in)), |
| 968 | (EXTRACT_SUBREG $in, sub_32)>; |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 969 | |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 970 | // Extending loads with i64 targets. |
Evan Cheng | e71fe34d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 971 | def : Pat<(zextloadi1 iaddr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 972 | (LBZ8 iaddr:$src)>; |
Evan Cheng | e71fe34d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 973 | def : Pat<(zextloadi1 xaddr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 974 | (LBZX8 xaddr:$src)>; |
Evan Cheng | e71fe34d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 975 | def : Pat<(extloadi1 iaddr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 976 | (LBZ8 iaddr:$src)>; |
Evan Cheng | e71fe34d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 977 | def : Pat<(extloadi1 xaddr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 978 | (LBZX8 xaddr:$src)>; |
Evan Cheng | e71fe34d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 979 | def : Pat<(extloadi8 iaddr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 980 | (LBZ8 iaddr:$src)>; |
Evan Cheng | e71fe34d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 981 | def : Pat<(extloadi8 xaddr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 982 | (LBZX8 xaddr:$src)>; |
Evan Cheng | e71fe34d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 983 | def : Pat<(extloadi16 iaddr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 984 | (LHZ8 iaddr:$src)>; |
Evan Cheng | e71fe34d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 985 | def : Pat<(extloadi16 xaddr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 986 | (LHZX8 xaddr:$src)>; |
Evan Cheng | e71fe34d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 987 | def : Pat<(extloadi32 iaddr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 988 | (LWZ8 iaddr:$src)>; |
Evan Cheng | e71fe34d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 989 | def : Pat<(extloadi32 xaddr:$src), |
Chris Lattner | 96aecb5 | 2006-07-14 04:42:02 +0000 | [diff] [blame] | 990 | (LWZX8 xaddr:$src)>; |
| 991 | |
Chris Lattner | 20b5a2b | 2008-03-07 20:18:24 +0000 | [diff] [blame] | 992 | // Standard shifts. These are represented separately from the real shifts above |
| 993 | // so that we can distinguish between shifts that allow 6-bit and 7-bit shift |
| 994 | // amounts. |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 995 | def : Pat<(sra i64:$rS, i32:$rB), |
| 996 | (SRAD $rS, $rB)>; |
| 997 | def : Pat<(srl i64:$rS, i32:$rB), |
| 998 | (SRD $rS, $rB)>; |
| 999 | def : Pat<(shl i64:$rS, i32:$rB), |
| 1000 | (SLD $rS, $rB)>; |
Chris Lattner | 20b5a2b | 2008-03-07 20:18:24 +0000 | [diff] [blame] | 1001 | |
Chris Lattner | b429983 | 2006-06-16 20:22:01 +0000 | [diff] [blame] | 1002 | // SHL/SRL |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 1003 | def : Pat<(shl i64:$in, (i32 imm:$imm)), |
| 1004 | (RLDICR $in, imm:$imm, (SHL64 imm:$imm))>; |
| 1005 | def : Pat<(srl i64:$in, (i32 imm:$imm)), |
| 1006 | (RLDICL $in, (SRL64 imm:$imm), imm:$imm)>; |
Chris Lattner | 2d4e8f7 | 2006-06-20 21:23:06 +0000 | [diff] [blame] | 1007 | |
Evan Cheng | 4dbd9f2 | 2007-09-04 20:20:29 +0000 | [diff] [blame] | 1008 | // ROTL |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 1009 | def : Pat<(rotl i64:$in, i32:$sh), |
| 1010 | (RLDCL $in, $sh, 0)>; |
| 1011 | def : Pat<(rotl i64:$in, (i32 imm:$imm)), |
| 1012 | (RLDICL $in, imm:$imm, 0)>; |
Evan Cheng | 4dbd9f2 | 2007-09-04 20:20:29 +0000 | [diff] [blame] | 1013 | |
Chris Lattner | 2d4e8f7 | 2006-06-20 21:23:06 +0000 | [diff] [blame] | 1014 | // Hi and Lo for Darwin Global Addresses. |
| 1015 | def : Pat<(PPChi tglobaladdr:$in, 0), (LIS8 tglobaladdr:$in)>; |
| 1016 | def : Pat<(PPClo tglobaladdr:$in, 0), (LI8 tglobaladdr:$in)>; |
| 1017 | def : Pat<(PPChi tconstpool:$in , 0), (LIS8 tconstpool:$in)>; |
| 1018 | def : Pat<(PPClo tconstpool:$in , 0), (LI8 tconstpool:$in)>; |
| 1019 | def : Pat<(PPChi tjumptable:$in , 0), (LIS8 tjumptable:$in)>; |
| 1020 | def : Pat<(PPClo tjumptable:$in , 0), (LI8 tjumptable:$in)>; |
Bob Wilson | f84f710 | 2009-11-04 21:31:18 +0000 | [diff] [blame] | 1021 | def : Pat<(PPChi tblockaddress:$in, 0), (LIS8 tblockaddress:$in)>; |
| 1022 | def : Pat<(PPClo tblockaddress:$in, 0), (LI8 tblockaddress:$in)>; |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 1023 | def : Pat<(PPChi tglobaltlsaddr:$g, i64:$in), |
| 1024 | (ADDIS8 $in, tglobaltlsaddr:$g)>; |
| 1025 | def : Pat<(PPClo tglobaltlsaddr:$g, i64:$in), |
Ulrich Weigand | 35f9fdf | 2013-03-26 10:55:20 +0000 | [diff] [blame] | 1026 | (ADDI8 $in, tglobaltlsaddr:$g)>; |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 1027 | def : Pat<(add i64:$in, (PPChi tglobaladdr:$g, 0)), |
| 1028 | (ADDIS8 $in, tglobaladdr:$g)>; |
| 1029 | def : Pat<(add i64:$in, (PPChi tconstpool:$g, 0)), |
| 1030 | (ADDIS8 $in, tconstpool:$g)>; |
| 1031 | def : Pat<(add i64:$in, (PPChi tjumptable:$g, 0)), |
| 1032 | (ADDIS8 $in, tjumptable:$g)>; |
| 1033 | def : Pat<(add i64:$in, (PPChi tblockaddress:$g, 0)), |
| 1034 | (ADDIS8 $in, tblockaddress:$g)>; |
Hal Finkel | b09680b | 2013-03-18 23:00:58 +0000 | [diff] [blame] | 1035 | |
| 1036 | // Patterns to match r+r indexed loads and stores for |
| 1037 | // addresses without at least 4-byte alignment. |
| 1038 | def : Pat<(i64 (unaligned4sextloadi32 xoaddr:$src)), |
| 1039 | (LWAX xoaddr:$src)>; |
| 1040 | def : Pat<(i64 (unaligned4load xoaddr:$src)), |
| 1041 | (LDX xoaddr:$src)>; |
Ulrich Weigand | ec6e2cd | 2013-03-25 19:04:58 +0000 | [diff] [blame] | 1042 | def : Pat<(unaligned4store i64:$rS, xoaddr:$dst), |
| 1043 | (STDX $rS, xoaddr:$dst)>; |
Hal Finkel | b09680b | 2013-03-18 23:00:58 +0000 | [diff] [blame] | 1044 | |