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